summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMorten Sorvig <msorvig@trolltech.com>2009-09-11 12:49:25 +0200
committerMorten Sorvig <msorvig@trolltech.com>2009-09-11 13:15:19 +0200
commit0293aff5c44202e5c62e229b74d8bd0bf9206185 (patch)
tree7d39cc70948368b0c35e364c63ef041f69fa2745 /src
parent6ac7728fe442988e86786cb75a851063b4380404 (diff)
Fix memory leak when deleteLater is triggered via the main menu bar.
The deleteLater was beeing created with loopLevel of 1, causing it to be defferd until QApplication::exec() returned. Add a QScopedLoopLevelCounter to increase the loopLevel while triggering the action. RevBy: Brad
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qcocoamenuloader_mac.mm2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm
index ce2a92c12e..9ab077f034 100644
--- a/src/gui/kernel/qcocoamenuloader_mac.mm
+++ b/src/gui/kernel/qcocoamenuloader_mac.mm
@@ -44,6 +44,7 @@
#include <qaction.h>
#include <qcoreapplication.h>
#include <private/qcocoamenuloader_mac_p.h>
+#include <private/qapplication_p.h>
#include <private/qt_mac_p.h>
#include <qmenubar.h>
@@ -198,6 +199,7 @@ QT_USE_NAMESPACE
- (IBAction)qtDispatcherToQAction:(id)sender
{
+ QScopedLoopLevelCounter loopLevelCounter(QApplicationPrivate::instance()->threadData);
NSMenuItem *item = static_cast<NSMenuItem *>(sender);
if (QAction *action = reinterpret_cast<QAction *>([item tag])) {
action->trigger();