From: Emmanuel Pescosta Date: Thu, 29 Jan 2015 12:45:14 +0000 (+0100) Subject: Revert commit 0c6c76b038e868e225f7816fae39635d472bce0a and make the X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/f8187b982afbcd16d15756d8a9840222cfe91d2d Revert commit 0c6c76b038e868e225f7816fae39635d472bce0a and make the QWeakPointer a QPointer (+comment) to make it clear, that we must track the lifetime of the context menu instead of doing "only" out of scope deleting. Thanks to Frank for pointing out this problem! CCMAIL: frank78ac@googlemail.com --- diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 398af70a8..1360a42e5 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -758,7 +758,7 @@ void DolphinMainWindow::openContextMenu(const QPoint& pos, const QUrl& url, const QList& customActions) { - QScopedPointer contextMenu(new DolphinContextMenu(this, pos, item, url)); + QPointer contextMenu = new DolphinContextMenu(this, pos, item, url); contextMenu.data()->setCustomActions(customActions); const DolphinContextMenu::Command command = contextMenu.data()->open(); @@ -781,6 +781,11 @@ void DolphinMainWindow::openContextMenu(const QPoint& pos, default: break; } + + // Delete the menu, unless it has been deleted in its own nested event loop already. + if (contextMenu) { + contextMenu->deleteLater(); + } } void DolphinMainWindow::updateControlMenu()