macOS: Don't send posted events via runloop observer
The logic was added in b0016ea9a6b225757e3ee06b50e8f7d05463ddf7, but the test-case in the bug report works fine without this logic. As sending events from a runloop observer is dubious, and causes problems since it's not tied to the quite complex machinery of the general event processing, it's better to remove it. The original issue is already tested by sendEventsOnProcessEvents in tst_QCore/GuiApplication. Task-number: QTBUG-4521 Change-Id: I857519a09a13a72b7434727c0229606403be7ed3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
5809c6fffd
commit
554ba2c39b
@ -148,7 +148,6 @@ public:
|
||||
QList<void *> queuedUserInputEvents; // NSEvent *
|
||||
CFRunLoopSourceRef postedEventsSource;
|
||||
CFRunLoopObserverRef waitingObserver;
|
||||
CFRunLoopObserverRef firstTimeObserver;
|
||||
QAtomicInt serialNumber;
|
||||
int lastSerial;
|
||||
bool interrupt;
|
||||
@ -157,7 +156,6 @@ public:
|
||||
static void postedEventsSourceCallback(void *info);
|
||||
static void waitingObserverCallback(CFRunLoopObserverRef observer,
|
||||
CFRunLoopActivity activity, void *info);
|
||||
static void firstLoopEntry(CFRunLoopObserverRef ref, CFRunLoopActivity activity, void *info);
|
||||
bool sendQueuedUserInputEvents();
|
||||
void processPostedEvents();
|
||||
};
|
||||
|
@ -818,21 +818,6 @@ QCocoaEventDispatcher::QCocoaEventDispatcher(QObject *parent)
|
||||
QCocoaEventDispatcherPrivate::waitingObserverCallback,
|
||||
&observerContext);
|
||||
CFRunLoopAddObserver(mainRunLoop(), d->waitingObserver, kCFRunLoopCommonModes);
|
||||
|
||||
/* The first cycle in the loop adds the source and the events of the source
|
||||
are not processed.
|
||||
We use an observer to process the posted events for the first
|
||||
execution of the loop. */
|
||||
CFRunLoopObserverContext firstTimeObserverContext;
|
||||
bzero(&firstTimeObserverContext, sizeof(CFRunLoopObserverContext));
|
||||
firstTimeObserverContext.info = d;
|
||||
d->firstTimeObserver = CFRunLoopObserverCreate(kCFAllocatorDefault,
|
||||
kCFRunLoopEntry,
|
||||
/* repeats = */ false,
|
||||
0,
|
||||
QCocoaEventDispatcherPrivate::firstLoopEntry,
|
||||
&firstTimeObserverContext);
|
||||
CFRunLoopAddObserver(mainRunLoop(), d->firstTimeObserver, kCFRunLoopCommonModes);
|
||||
}
|
||||
|
||||
void QCocoaEventDispatcherPrivate::waitingObserverCallback(CFRunLoopObserverRef,
|
||||
@ -897,25 +882,6 @@ void QCocoaEventDispatcherPrivate::processPostedEvents()
|
||||
}
|
||||
}
|
||||
|
||||
void QCocoaEventDispatcherPrivate::firstLoopEntry(CFRunLoopObserverRef ref,
|
||||
CFRunLoopActivity activity,
|
||||
void *info)
|
||||
{
|
||||
Q_UNUSED(ref);
|
||||
Q_UNUSED(activity);
|
||||
|
||||
QCocoaEventDispatcherPrivate *d = static_cast<QCocoaEventDispatcherPrivate *>(info);
|
||||
if (d->initializingNSApplication) {
|
||||
qCDebug(lcEventDispatcher) << "Deferring" << __FUNCTION__ << "due to NSApp initialization";
|
||||
// We don't want to process any sources during explicit NSApplication
|
||||
// initialization, so defer the source until the actual event processing.
|
||||
CFRunLoopSourceSignal(d->postedEventsSource);
|
||||
return;
|
||||
}
|
||||
|
||||
static_cast<QCocoaEventDispatcherPrivate *>(info)->processPostedEvents();
|
||||
}
|
||||
|
||||
void QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void *info)
|
||||
{
|
||||
QCocoaEventDispatcherPrivate *d = static_cast<QCocoaEventDispatcherPrivate *>(info);
|
||||
@ -1017,9 +983,6 @@ QCocoaEventDispatcher::~QCocoaEventDispatcher()
|
||||
|
||||
CFRunLoopObserverInvalidate(d->waitingObserver);
|
||||
CFRelease(d->waitingObserver);
|
||||
|
||||
CFRunLoopObserverInvalidate(d->firstTimeObserver);
|
||||
CFRelease(d->firstTimeObserver);
|
||||
}
|
||||
|
||||
QtCocoaInterruptDispatcher* QtCocoaInterruptDispatcher::instance = nullptr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user