Reviewed by Timothy.
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Apr 2006 02:06:44 +0000 (02:06 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Apr 2006 02:06:44 +0000 (02:06 +0000)
        http://bugzilla.opendarwin.org/show_bug.cgi?id=6635
        Bug 6635: Crash selecting inspector nodes for tabs that aren't foremost

        Stop observing window will close notifications before we tell the highlight window to close,
        this prevents the crash. Also prevent drawing highlights for hidden tabs.

        * WebInspector/WebInspector.m:
        (-[WebInspector _highlightNode:]):
        * WebInspector/WebNodeHighlight.m:
        (-[WebNodeHighlight expire]):

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

WebKit/ChangeLog
WebKit/WebInspector/WebInspector.m
WebKit/WebInspector/WebNodeHighlight.m

index 64a36bacd9c217b3909afd42ca8a4a6cd036abc9..46dc65d50246cc75030036cd987540e4b03c30eb 100644 (file)
@@ -1,3 +1,18 @@
+2006-04-19  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Timothy.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=6635
+        Bug 6635: Crash selecting inspector nodes for tabs that aren't foremost
+
+        Stop observing window will close notifications before we tell the highlight window to close,
+        this prevents the crash. Also prevent drawing highlights for hidden tabs.
+
+        * WebInspector/WebInspector.m:
+        (-[WebInspector _highlightNode:]):
+        * WebInspector/WebNodeHighlight.m:
+        (-[WebNodeHighlight expire]):
+
 2006-04-19  James G. Speth  <speth@end.com>
 
         Reviewed by Timothy.
index 8bb35a0644f6fe944784ece24c2b557f8f80e272..c30f159b96440cb43c9e9f723a49b98090171f05 100644 (file)
@@ -530,7 +530,8 @@ static NSMapTable *lastChildIgnoringWhitespaceCache = NULL;
         if (![rects count])
             rects = [NSArray arrayWithObject:[NSValue valueWithRect:bounds]];
 
-        _private->currentHighlight = [[WebNodeHighlight alloc] initWithBounds:bounds andRects:rects forView:view];
+        if ([view window])      // skip the highlight if we have no window (e.g. hidden tab)
+            _private->currentHighlight = [[WebNodeHighlight alloc] initWithBounds:bounds andRects:rects forView:view];
     }
 }
 
index 851b1dcf97bcda1dac3aec28e9f44511d9377152..f9b50d9e8043c0e470dde79c63267282381e8160 100644 (file)
@@ -106,14 +106,20 @@ NSString *WebNodeHighlightExpiredNotification = @"WebNodeHighlightExpiredNotific
 
 - (void)expire
 {
+    if (![_timer isValid])  // make sure it has not been expired already (loop prevention)
+        return;
+    
     [_timer invalidate];
     [_timer release];
     _timer = nil;
 
+    // remove this observation before closing the window (more loop prevention)
+    [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification object:nil];
+    
     [_webNodeHighlightWindow close];
     _webNodeHighlightWindow = nil;
 
-    [[NSNotificationCenter defaultCenter] postNotificationName:@"WebNodeHighlightExpired" object:self userInfo:nil];
+    [[NSNotificationCenter defaultCenter] postNotificationName:WebNodeHighlightExpiredNotification object:self userInfo:nil];
 }
 
 - (void)redraw:(NSTimer *)timer