diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2013-04-26 09:32:01 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-26 12:08:24 +0200 |
commit | 2e69015d74a903d7319dec164214b9f443980a08 (patch) | |
tree | 5e2fbcd0785ad39bb37bc9a659072fd2f6e87400 /src/plugins/platforms/cocoa/qcocoamenuloader.mm | |
parent | 4ca105b9bbf5c1e9b539da9522c630574eba3471 (diff) |
Increase the loopLevel when activating menu items.
Apply 0293aff5c44202e5c62e229b74d8bd0bf9206185
from Qt 4.
Without this, calls to deleteLater() may create delete
later events with a loopLevel of 1. Those events will
not be processed until QApplication::exec() returns.
Add a QScopedLoopLevelCounter that increases the loopLevel
for the duration of the activated() call.
Task-number: QTBUG-30660
Change-Id: I7ab3bb3a53243691b8f7f64e025150e5cc7da2c8
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoamenuloader.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoamenuloader.mm | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm index 4fb7969ff4..62b722d2d2 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm @@ -47,10 +47,12 @@ #include "qcocoamenuitem.h" #include <QtCore/private/qcore_mac_p.h> +#include <QtCore/private/qthread_p.h> #include <QtCore/qcoreapplication.h> #include <QtCore/qdir.h> #include <QtCore/qstring.h> #include <QtCore/qdebug.h> +#include <QtGui/private/qguiapplication_p.h> QT_FORWARD_DECLARE_CLASS(QCFString) QT_FORWARD_DECLARE_CLASS(QString) @@ -305,6 +307,7 @@ QT_END_NAMESPACE if ([item tag]) { QCocoaMenuItem *cocoaItem = reinterpret_cast<QCocoaMenuItem *>([item tag]); + QScopedLoopLevelCounter loopLevelCounter(QGuiApplicationPrivate::instance()->threadData); cocoaItem->activated(); } } |