Skip to content

Commit

Permalink
Apply WTrackTableView sorting in showEvent to avoid race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Jun 6, 2019
1 parent 0909888 commit 40725b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/widget/wtracktableview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,20 +414,21 @@ void WTrackTableView::loadTrackModel(QAbstractItemModel *model) {
// the flags(...) function that we're already using in LibraryTableModel. I
// haven't been able to get it to stop us from using a model as a drag
// target though, so my hax above may not be completely unjustified.

setVisible(true);

if (m_sorting) {
// Sorting has to be applied after setVisible(true), since only visible
// WTrackTableViews will be sorted
applySorting();
}

restoreVScrollBarPos(newModel);
// restoring scrollBar position using model pointer as key
// scrollbar positions with respect to different models are backed by map
}

void WTrackTableView::showEvent(QShowEvent *event) {
WLibraryTableView::showEvent(event);
if (m_sorting) {
applySorting();
}
}

void WTrackTableView::createActions() {
DEBUG_ASSERT(m_pMenu);
DEBUG_ASSERT(m_pSamplerMenu);
Expand Down
1 change: 1 addition & 0 deletions src/widget/wtracktableview.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class WTrackTableView : public WLibraryTableView {
void dragMoveEvent(QDragMoveEvent * event) override;
void dragEnterEvent(QDragEnterEvent * event) override;
void dropEvent(QDropEvent * event) override;
void showEvent(QShowEvent *event) override;
void lockBpm(bool lock);

void enableCachedOnly();
Expand Down

0 comments on commit 40725b0

Please sign in to comment.