macOS: Remove workaround for queued input events to stale windows
We now track the platform window with a QPointer, so the event callbacks can (and do) check the validity of the platform window before passing them on. The window property of the NSView is also nil at the point of even delivery, if we need another way to check if the event is still valid. Task-number: QTBUG-39211 Change-Id: I6179bdb3af9606cd0abf981c0fe6cacb9a2d98ab Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
c888d302bc
commit
85cbd35178
@ -177,8 +177,6 @@ public:
|
||||
void maybeCancelWaitForMoreEvents();
|
||||
void ensureNSAppInitialized();
|
||||
|
||||
void removeQueuedUserInputEvents(int nsWinNumber);
|
||||
|
||||
QCFSocketNotifier cfSocketNotifier;
|
||||
QList<void *> queuedUserInputEvents; // NSEvent *
|
||||
CFRunLoopSourceRef postedEventsSource;
|
||||
|
@ -889,21 +889,6 @@ void QCocoaEventDispatcherPrivate::processPostedEvents()
|
||||
}
|
||||
}
|
||||
|
||||
void QCocoaEventDispatcherPrivate::removeQueuedUserInputEvents(int nsWinNumber)
|
||||
{
|
||||
if (nsWinNumber) {
|
||||
int eventIndex = queuedUserInputEvents.size();
|
||||
|
||||
while (--eventIndex >= 0) {
|
||||
NSEvent * nsevent = static_cast<NSEvent *>(queuedUserInputEvents.at(eventIndex));
|
||||
if ([nsevent windowNumber] == nsWinNumber) {
|
||||
queuedUserInputEvents.removeAt(eventIndex);
|
||||
[nsevent release];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QCocoaEventDispatcherPrivate::firstLoopEntry(CFRunLoopObserverRef ref,
|
||||
CFRunLoopActivity activity,
|
||||
void *info)
|
||||
|
@ -147,15 +147,7 @@ static bool isMouseEvent(NSEvent *ev)
|
||||
|
||||
- (void)clearWindow
|
||||
{
|
||||
if (_window) {
|
||||
QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher());
|
||||
if (cocoaEventDispatcher) {
|
||||
QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = static_cast<QCocoaEventDispatcherPrivate *>(QObjectPrivate::get(cocoaEventDispatcher));
|
||||
cocoaEventDispatcherPrivate->removeQueuedUserInputEvents([_window windowNumber]);
|
||||
}
|
||||
|
||||
_window = nil;
|
||||
}
|
||||
_window = nil;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
|
Loading…
Reference in New Issue
Block a user