diff --git a/src/library/trackset/crate/cratefeature.cpp b/src/library/trackset/crate/cratefeature.cpp index c3fa30e7710..4399c0bdf69 100644 --- a/src/library/trackset/crate/cratefeature.cpp +++ b/src/library/trackset/crate/cratefeature.cpp @@ -55,7 +55,8 @@ CrateFeature::CrateFeature(Library* pLibrary, : BaseTrackSetFeature(pLibrary, pConfig, "CRATEHOME", QStringLiteral("crates")), m_lockedCrateIcon(":/images/library/ic_library_locked_tracklist.svg"), m_pTrackCollection(pLibrary->trackCollectionManager()->internalCollection()), - m_crateTableModel(this, pLibrary->trackCollectionManager()) { + m_crateTableModel(this, pLibrary->trackCollectionManager()), + m_folderMenuInitialized(false) { initActions(); // construct child model @@ -590,12 +591,12 @@ void CrateFeature::onRightClickChild( moveToFolderMenu->setTitle(tr("Move to Folder")); moveToFolderMenu->setObjectName("FolderMenu"); - bool folderMenuInitialized = false; + m_folderMenuInitialized = false; connect(moveToFolderMenu, &QMenu::aboutToShow, this, - [this, moveToFolderMenu, &folderMenuInitialized, selectionId] { - if (folderMenuInitialized) { + [this, moveToFolderMenu, selectionId] { + if (m_folderMenuInitialized) { return; } moveToFolderMenu->clear(); @@ -623,7 +624,7 @@ void CrateFeature::onRightClickChild( moveToFolderMenu->addSeparator(); moveToFolderMenu->addAction(m_pAddToNewFolderAction); - folderMenuInitialized = true; + m_folderMenuInitialized = true; }); if (selectionId.isCrate()) { @@ -684,6 +685,7 @@ void CrateFeature::onRightClickChild( } menu.exec(globalPos); + m_folderMenuInitialized = false; } void CrateFeature::slotCreateCrate() { diff --git a/src/library/trackset/crate/cratefeature.h b/src/library/trackset/crate/cratefeature.h index 65fdd6473d3..376808ac035 100644 --- a/src/library/trackset/crate/cratefeature.h +++ b/src/library/trackset/crate/cratefeature.h @@ -153,6 +153,8 @@ class CrateFeature : public BaseTrackSetFeature { QModelIndex m_lastRightClickedIndex; TrackId m_selectedTrackId; + bool m_folderMenuInitialized; + parented_ptr m_pCreateCrateAction; parented_ptr m_pCreateFolderAction; parented_ptr m_pAddToNewFolderAction;