diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-10-24 08:58:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-24 08:58:28 +0200 |
commit | f5b13e91d18a414dae5e384b377ead66bc8d898f (patch) | |
tree | 27a81fad115cefecd5dfc70791047757da8926ce /widget | |
parent | f71c04d814416ebf52dd54109f2d04f1cbd397c0 (diff) | |
parent | 065f6f9e5ebc1ed6cfaadaf7851b6021fa94a013 (diff) | |
download | uxp-f5b13e91d18a414dae5e384b377ead66bc8d898f.tar.gz |
Merge pull request #852 from wicknix/master
Bug 1489785: Remove a workaround for gcc
Diffstat (limited to 'widget')
-rw-r--r-- | widget/cocoa/nsChildView.mm | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 8f72a81bec..1a257d899d 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -425,13 +425,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; } @@ -6513,48 +6506,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__ |