commit 0c004047822a94a6e16851a9f46d237be10eebce Author: Stephen A Pohl spohl.mozilla.bugs@gmail.com Date: Sun Sep 30 01:02:08 2018 -0400
Bug 1489785: Remove a workaround for gcc, introduced in bug 678607, that is no longer needed and that causes hangs in modal dialogs on macOS 10.14. r=mstange, a=jcristau
--HG-- extra : source : 3920c858319dff66ebbc9263f6aa8d24f16071f8 extra : intermediate-source : d7a52857cd862b4e2f8305baddc119f4e9a47146 --- widget/cocoa/nsChildView.mm | 52 --------------------------------------------- 1 file changed, 52 deletions(-)
diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 8ffafc5d148e..072d59d0c010 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -442,13 +442,6 @@ nsChildView::Create(nsIWidget* aParent, if (!gChildViewMethodsSwizzled) { nsToolkit::SwizzleMethods([NSView class], @selector(mouseDownCanMoveWindow), @selector(nsChildView_NSView_mouseDownCanMoveWindow)); -#ifdef __LP64__ - nsToolkit::SwizzleMethods([NSEvent class], @selector(addLocalMonitorForEventsMatchingMask:handler:), - @selector(nsChildView_NSEvent_addLocalMonitorForEventsMatchingMask:handler:), - true); - nsToolkit::SwizzleMethods([NSEvent class], @selector(removeMonitor:), - @selector(nsChildView_NSEvent_removeMonitor:), true); -#endif gChildViewMethodsSwizzled = true; }
@@ -7134,48 +7127,3 @@ static const CGEventField kCGWindowNumberField = (const CGEventField) 51; }
@end - -#ifdef __LP64__ -// When using blocks, at least on OS X 10.7, the OS sometimes calls -// +[NSEvent removeMonitor:] more than once on a single event monitor, which -// causes crashes. See bug 678607. We hook these methods to work around -// the problem. -@interface NSEvent (MethodSwizzling) -+ (id)nsChildView_NSEvent_addLocalMonitorForEventsMatchingMask:(unsigned long long)mask handler:(id)block; -+ (void)nsChildView_NSEvent_removeMonitor:(id)eventMonitor; -@end - -// This is a local copy of the AppKit frameworks sEventObservers hashtable. -// It only stores "local monitors". We use it to ensure that +[NSEvent -// removeMonitor:] is never called more than once on the same local monitor. -static NSHashTable *sLocalEventObservers = nil; - -@implementation NSEvent (MethodSwizzling) - -+ (id)nsChildView_NSEvent_addLocalMonitorForEventsMatchingMask:(unsigned long long)mask handler:(id)block -{ - if (!sLocalEventObservers) { - sLocalEventObservers = [[NSHashTable hashTableWithOptions: - NSHashTableStrongMemory | NSHashTableObjectPointerPersonality] retain]; - } - id retval = - [self nsChildView_NSEvent_addLocalMonitorForEventsMatchingMask:mask handler:block]; - if (sLocalEventObservers && retval && ![sLocalEventObservers containsObject:retval]) { - [sLocalEventObservers addObject:retval]; - } - return retval; -} - -+ (void)nsChildView_NSEvent_removeMonitor:(id)eventMonitor -{ - if (sLocalEventObservers && [eventMonitor isKindOfClass: ::NSClassFromString(@"_NSLocalEventObserver")]) { - if (![sLocalEventObservers containsObject:eventMonitor]) { - return; - } - [sLocalEventObservers removeObject:eventMonitor]; - } - [self nsChildView_NSEvent_removeMonitor:eventMonitor]; -} - -@end -#endif // #ifdef __LP64__
tor-commits@lists.torproject.org