diff options
-rw-r--r-- | src/gui/kernel/qeventdispatcher_mac.mm | 18 | ||||
-rw-r--r-- | src/gui/kernel/qeventdispatcher_mac_p.h | 1 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index 7a3af86..7152705 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -917,14 +917,13 @@ QEventDispatcherMac::QEventDispatcherMac(QObject *parent) CFRunLoopObserverContext firstTimeObserverContext; bzero(&firstTimeObserverContext, sizeof(CFRunLoopObserverContext)); firstTimeObserverContext.info = d; - CFRunLoopObserverRef firstTimeObserver = CFRunLoopObserverCreate(kCFAllocatorDefault, - kCFRunLoopEntry, - /* repeats = */ false, - 0, - QEventDispatcherMacPrivate::firstLoopEntry, - &firstTimeObserverContext); - CFRunLoopAddObserver(mainRunLoop(), firstTimeObserver, kCFRunLoopCommonModes); - CFRelease(firstTimeObserver); + d->firstTimeObserver = CFRunLoopObserverCreate(kCFAllocatorDefault, + kCFRunLoopEntry, + /* repeats = */ false, + 0, + QEventDispatcherMacPrivate::firstLoopEntry, + &firstTimeObserverContext); + CFRunLoopAddObserver(mainRunLoop(), d->firstTimeObserver, kCFRunLoopCommonModes); } void QEventDispatcherMacPrivate::waitingObserverCallback(CFRunLoopObserverRef, @@ -1025,6 +1024,9 @@ QEventDispatcherMac::~QEventDispatcherMac() CFRunLoopObserverInvalidate(d->waitingObserver); CFRelease(d->waitingObserver); + + CFRunLoopObserverInvalidate(d->firstTimeObserver); + CFRelease(d->firstTimeObserver); } ///////////////////////////////////////////////////////////////////////////// diff --git a/src/gui/kernel/qeventdispatcher_mac_p.h b/src/gui/kernel/qeventdispatcher_mac_p.h index 15bc6f8..dfcb91f 100644 --- a/src/gui/kernel/qeventdispatcher_mac_p.h +++ b/src/gui/kernel/qeventdispatcher_mac_p.h @@ -187,6 +187,7 @@ public: QList<void *> queuedUserInputEvents; // List of EventRef in Carbon, and NSEvent * in Cocoa CFRunLoopSourceRef postedEventsSource; CFRunLoopObserverRef waitingObserver; + CFRunLoopObserverRef firstTimeObserver; QAtomicInt serialNumber; int lastSerial; bool interrupt; |