summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qcocoamenuloader_mac.mm
diff options
context:
space:
mode:
authorMorten Sorvig <msorvig@trolltech.com>2009-09-11 10:49:25 (GMT)
committerMorten Sorvig <msorvig@trolltech.com>2009-09-11 11:15:19 (GMT)
commit0293aff5c44202e5c62e229b74d8bd0bf9206185 (patch)
tree7d39cc70948368b0c35e364c63ef041f69fa2745 /src/gui/kernel/qcocoamenuloader_mac.mm
parent6ac7728fe442988e86786cb75a851063b4380404 (diff)
downloadQt-0293aff5c44202e5c62e229b74d8bd0bf9206185.zip
Qt-0293aff5c44202e5c62e229b74d8bd0bf9206185.tar.gz
Qt-0293aff5c44202e5c62e229b74d8bd0bf9206185.tar.bz2
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/gui/kernel/qcocoamenuloader_mac.mm')
-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 ce2a92c..9ab077f 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();