From 00bbab0dbfde79cfc6a3dc6060d7c87763f07482 Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Tue, 13 Dec 2011 15:09:16 +0100 Subject: Fix Memoy leak relateded to contextmenu. From Qt4.7 on, the contextmenu of QTextEdit/QPlainTextEdit/QLineEdit/QLabel/QMainWindow etc using QMenu::popup() instead of QMenu::exec(), but the setAttribute(Qt::WA_DeleteOnClose) does not work, as QMenu::close() isn't called when the menus disapper. And this causes a memory leak. Task-number: QTBUG-22817 Merge-request: 2721 Reviewed-by: Frederik Gladhorn --- src/gui/widgets/qmenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index a490286..eb57caa 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -513,7 +513,7 @@ void QMenuPrivate::hideMenu(QMenu *menu, bool justRegister) menu->blockSignals(false); #endif // QT_NO_EFFECTS if (!justRegister) - menu->hide(); + menu->close(); } void QMenuPrivate::popupAction(QAction *action, int delay, bool activateFirst) -- cgit v0.12