diff options
author | Benjamin Poulain <benjamin.poulain@nokia.com> | 2009-09-21 17:07:00 (GMT) |
---|---|---|
committer | Benjamin Poulain <benjamin.poulain@nokia.com> | 2009-09-21 17:10:19 (GMT) |
commit | ea0c0dfa64f5c614bfd728f323d9b6731ee4898c (patch) | |
tree | 61fbc32d81aa482e74d9ecdfa7e1d174d756a18b | |
parent | 929538dde9f682b95e6f1c05e543e9d921af76e4 (diff) | |
download | Qt-ea0c0dfa64f5c614bfd728f323d9b6731ee4898c.zip Qt-ea0c0dfa64f5c614bfd728f323d9b6731ee4898c.tar.gz Qt-ea0c0dfa64f5c614bfd728f323d9b6731ee4898c.tar.bz2 |
The firstTimeObserver is not released if the event loop is never run
Previously, the firstTimeObserver was released by the event loop. This
do not work if the event loop is never run.
This commit amend b0016ea9a6b225757e3ee06b50e8f7d05463ddf7.
-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; |