<rdar://problem/10702758> REGRESSION: Every Safari Reader WKView leaks
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jan 2012 01:17:48 +0000 (01:17 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jan 2012 01:17:48 +0000 (01:17 +0000)
Reviewed by John Sullivan and Ada Chan.

* UIProcess/API/mac/WKView.mm:
(-[WKView viewDidMoveToWindow]): Since this method can be called multiple times in a row
while [self window] is non-nil, check if there isn’t already an event monitor before adding
a new one.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@105112 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/WKView.mm

index 8753af86de48ac150e3a8b74588ee798de3c6259..743b93a815a65f6577bab26eeb318dd338199bb0 100644 (file)
@@ -1,3 +1,14 @@
+2012-01-16  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/10702758> REGRESSION: Every Safari Reader WKView leaks
+
+        Reviewed by John Sullivan and Ada Chan.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView viewDidMoveToWindow]): Since this method can be called multiple times in a row
+        while [self window] is non-nil, check if there isn’t already an event monitor before adding
+        a new one.
+
 2012-01-16  Anders Carlsson  <andersca@apple.com>
 
         Crash when calling SecItemAdd with a null result pointer
index 0cecbd75a8ed178984cb5893755fb94ffc0b6555..f53a69487f745c46edac4dff90cc35bd90cee7f9 100644 (file)
@@ -1834,10 +1834,12 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
         [self _updateWindowVisibility];
         [self _updateWindowAndViewFrames];
 
-        _data->_flagsChangedEventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSFlagsChangedMask handler:^(NSEvent *flagsChangedEvent) {
-            [self _postFakeMouseMovedEventForFlagsChangedEvent:flagsChangedEvent];
-            return flagsChangedEvent;
-        }];
+        if (!_data->_flagsChangedEventMonitor) {
+            _data->_flagsChangedEventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSFlagsChangedMask handler:^(NSEvent *flagsChangedEvent) {
+                [self _postFakeMouseMovedEventForFlagsChangedEvent:flagsChangedEvent];
+                return flagsChangedEvent;
+            }];
+        }
 
         [self _accessibilityRegisterUIProcessTokens];
     } else {