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>
This commit is contained in:
parent
4ca105b9bb
commit
2e69015d74
@ -45,6 +45,8 @@
|
|||||||
#include "qcocoaautoreleasepool.h"
|
#include "qcocoaautoreleasepool.h"
|
||||||
|
|
||||||
#include <QtCore/QtDebug>
|
#include <QtCore/QtDebug>
|
||||||
|
#include <QtCore/private/qthread_p.h>
|
||||||
|
#include <QtGui/private/qguiapplication_p.h>
|
||||||
#include "qcocoaapplication.h"
|
#include "qcocoaapplication.h"
|
||||||
#include "qcocoamenuloader.h"
|
#include "qcocoamenuloader.h"
|
||||||
#include "qcocoawindow.h"
|
#include "qcocoawindow.h"
|
||||||
@ -110,6 +112,7 @@ static inline QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *getMenuLoader()
|
|||||||
- (void) itemFired:(NSMenuItem*) item
|
- (void) itemFired:(NSMenuItem*) item
|
||||||
{
|
{
|
||||||
QCocoaMenuItem *cocoaItem = reinterpret_cast<QCocoaMenuItem *>([item tag]);
|
QCocoaMenuItem *cocoaItem = reinterpret_cast<QCocoaMenuItem *>([item tag]);
|
||||||
|
QScopedLoopLevelCounter loopLevelCounter(QGuiApplicationPrivate::instance()->threadData);
|
||||||
cocoaItem->activated();
|
cocoaItem->activated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,10 +47,12 @@
|
|||||||
#include "qcocoamenuitem.h"
|
#include "qcocoamenuitem.h"
|
||||||
|
|
||||||
#include <QtCore/private/qcore_mac_p.h>
|
#include <QtCore/private/qcore_mac_p.h>
|
||||||
|
#include <QtCore/private/qthread_p.h>
|
||||||
#include <QtCore/qcoreapplication.h>
|
#include <QtCore/qcoreapplication.h>
|
||||||
#include <QtCore/qdir.h>
|
#include <QtCore/qdir.h>
|
||||||
#include <QtCore/qstring.h>
|
#include <QtCore/qstring.h>
|
||||||
#include <QtCore/qdebug.h>
|
#include <QtCore/qdebug.h>
|
||||||
|
#include <QtGui/private/qguiapplication_p.h>
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QCFString)
|
QT_FORWARD_DECLARE_CLASS(QCFString)
|
||||||
QT_FORWARD_DECLARE_CLASS(QString)
|
QT_FORWARD_DECLARE_CLASS(QString)
|
||||||
@ -305,6 +307,7 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
if ([item tag]) {
|
if ([item tag]) {
|
||||||
QCocoaMenuItem *cocoaItem = reinterpret_cast<QCocoaMenuItem *>([item tag]);
|
QCocoaMenuItem *cocoaItem = reinterpret_cast<QCocoaMenuItem *>([item tag]);
|
||||||
|
QScopedLoopLevelCounter loopLevelCounter(QGuiApplicationPrivate::instance()->threadData);
|
||||||
cocoaItem->activated();
|
cocoaItem->activated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user