Commit c89f1ddd authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix mem leak

parent 617d41b1
Pipeline #25684 passed with stage
in 38 minutes and 8 seconds
......@@ -45,12 +45,15 @@ RecentCollectionAction::RecentCollectionAction(Akonadi::StandardActionManager::T
RecentCollectionAction::~RecentCollectionAction()
{
//delete mRecentAction->menu();
if (needToDeleteMenu) {
delete mRecentAction->menu();
}
}
bool RecentCollectionAction::clear()
{
delete mRecentAction->menu();
needToDeleteMenu = false;
if (mListRecentCollection.isEmpty()) {
mRecentAction->setEnabled(false);
return true;
......@@ -66,6 +69,7 @@ void RecentCollectionAction::fillRecentCollection(Akonadi::StandardActionManager
QMenu *popup = new QMenu;
mRecentAction->setMenu(popup);
needToDeleteMenu = true;
const int numberOfRecentCollection(mListRecentCollection.count());
for (int i = 0; i < numberOfRecentCollection; ++i) {
......
......@@ -68,6 +68,7 @@ private:
const QAbstractItemModel *mModel = nullptr;
QAction *mRecentAction = nullptr;
KSharedConfig::Ptr mAkonadiConfig;
bool needToDeleteMenu = false;
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment