Title: [98178] trunk/Source/WebCore
Revision
98178
Author
bda...@apple.com
Date
2011-10-21 18:15:20 -0700 (Fri, 21 Oct 2011)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=70647
Common but unreproducible crash under [ScrollbarPartAnimation setCurrentProgress:]
-and corresponding-
<rdar://problem/9542018>

Reviewed by Sam Weinig.

This patch implements two speculative fixes for this crash.

First, block exceptions around all of the code responsible for calling 
stopAnimation. If that code throws any exceptions, we want to make sure the other 
animations are still stopped.
* platform/mac/ScrollAnimatorMac.mm:
(-[WebScrollbarPartAnimation scrollAnimatorDestroyed]):
(-[WebScrollbarPainterDelegate scrollAnimatorDestroyed]):
(WebCore::ScrollAnimatorMac::~ScrollAnimatorMac):

Only send AppKit these notifications for active pages. I originally made these 
assertions, and I found that they were hit a surprising number of times. If we 
only send notifications for active pages, then we should greatly reduce and 
possibly eliminate our chances of hitting this crash.
(WebCore::ScrollAnimatorMac::notifyPositionChanged):
(WebCore::ScrollAnimatorMac::contentAreaWillPaint):
(WebCore::ScrollAnimatorMac::mouseEnteredContentArea):
(WebCore::ScrollAnimatorMac::mouseExitedContentArea):
(WebCore::ScrollAnimatorMac::mouseMovedInContentArea):
(WebCore::ScrollAnimatorMac::willStartLiveResize):
(WebCore::ScrollAnimatorMac::contentsResized):
(WebCore::ScrollAnimatorMac::willEndLiveResize):
(WebCore::ScrollAnimatorMac::contentAreaDidShow):
(WebCore::ScrollAnimatorMac::contentAreaDidHide):
(WebCore::ScrollAnimatorMac::didBeginScrollGesture):
(WebCore::ScrollAnimatorMac::didEndScrollGesture):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (98177 => 98178)


--- trunk/Source/WebCore/ChangeLog	2011-10-22 00:48:40 UTC (rev 98177)
+++ trunk/Source/WebCore/ChangeLog	2011-10-22 01:15:20 UTC (rev 98178)
@@ -1,3 +1,39 @@
+2011-10-21  Beth Dakin  <bda...@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=70647
+        Common but unreproducible crash under [ScrollbarPartAnimation setCurrentProgress:]
+        -and corresponding-
+        <rdar://problem/9542018>
+
+        Reviewed by Sam Weinig.
+
+        This patch implements two speculative fixes for this crash.
+
+        First, block exceptions around all of the code responsible for calling 
+        stopAnimation. If that code throws any exceptions, we want to make sure the other 
+        animations are still stopped.
+        * platform/mac/ScrollAnimatorMac.mm:
+        (-[WebScrollbarPartAnimation scrollAnimatorDestroyed]):
+        (-[WebScrollbarPainterDelegate scrollAnimatorDestroyed]):
+        (WebCore::ScrollAnimatorMac::~ScrollAnimatorMac):
+
+        Only send AppKit these notifications for active pages. I originally made these 
+        assertions, and I found that they were hit a surprising number of times. If we 
+        only send notifications for active pages, then we should greatly reduce and 
+        possibly eliminate our chances of hitting this crash.
+        (WebCore::ScrollAnimatorMac::notifyPositionChanged):
+        (WebCore::ScrollAnimatorMac::contentAreaWillPaint):
+        (WebCore::ScrollAnimatorMac::mouseEnteredContentArea):
+        (WebCore::ScrollAnimatorMac::mouseExitedContentArea):
+        (WebCore::ScrollAnimatorMac::mouseMovedInContentArea):
+        (WebCore::ScrollAnimatorMac::willStartLiveResize):
+        (WebCore::ScrollAnimatorMac::contentsResized):
+        (WebCore::ScrollAnimatorMac::willEndLiveResize):
+        (WebCore::ScrollAnimatorMac::contentAreaDidShow):
+        (WebCore::ScrollAnimatorMac::contentAreaDidHide):
+        (WebCore::ScrollAnimatorMac::didBeginScrollGesture):
+        (WebCore::ScrollAnimatorMac::didEndScrollGesture):
+
 2011-10-21  Mark Hahnenberg  <mhahnenb...@apple.com>
 
         Add put to the MethodTable

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (98177 => 98178)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2011-10-22 00:48:40 UTC (rev 98177)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2011-10-22 01:15:20 UTC (rev 98178)
@@ -29,6 +29,7 @@
 
 #include "ScrollAnimatorMac.h"
 
+#include "BlockExceptions.h"
 #include "FloatPoint.h"
 #include "NSScrollerImpDetails.h"
 #include "PlatformGestureEvent.h"
@@ -297,7 +298,9 @@
 
 - (void)scrollAnimatorDestroyed
 {
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     [self stopAnimation];
+    END_BLOCK_OBJC_EXCEPTIONS;
     _animator = 0;
 }
 
@@ -331,10 +334,12 @@
 
 - (void)cancelAnimations
 {
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     [_verticalKnobAnimation.get() stopAnimation];
     [_horizontalKnobAnimation.get() stopAnimation];
     [_verticalTrackAnimation.get() stopAnimation];
     [_horizontalTrackAnimation.get() stopAnimation];
+    END_BLOCK_OBJC_EXCEPTIONS;
 }
 
 - (NSRect)convertRectToBacking:(NSRect)aRect
@@ -435,10 +440,12 @@
 - (void)scrollAnimatorDestroyed
 {
     _animator = 0;
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     [_verticalKnobAnimation.get() scrollAnimatorDestroyed];
     [_horizontalKnobAnimation.get() scrollAnimatorDestroyed];
     [_verticalTrackAnimation.get() scrollAnimatorDestroyed];
     [_horizontalTrackAnimation.get() scrollAnimatorDestroyed];
+    END_BLOCK_OBJC_EXCEPTIONS;
 }
 
 @end
@@ -489,10 +496,12 @@
 ScrollAnimatorMac::~ScrollAnimatorMac()
 {
 #if USE(SCROLLBAR_PAINTER)
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     [m_scrollbarPainterControllerDelegate.get() scrollAnimatorDestroyed];
     [m_scrollbarPainterController.get() setDelegate:nil];
     [m_scrollbarPainterDelegate.get() scrollAnimatorDestroyed];
     [m_scrollAnimationHelperDelegate.get() scrollAnimatorDestroyed];
+    END_BLOCK_OBJC_EXCEPTIONS;
 #endif
 }
 
@@ -604,6 +613,8 @@
 
 void ScrollAnimatorMac::notifyPositionChanged()
 {
+    if (!scrollableArea()->isOnActivePage())
+        return;
 #if USE(SCROLLBAR_PAINTER)
     [m_scrollbarPainterController.get() contentAreaScrolled];
 #endif
@@ -612,6 +623,8 @@
 
 void ScrollAnimatorMac::contentAreaWillPaint() const
 {
+    if (!scrollableArea()->isOnActivePage())
+        return;
 #if USE(SCROLLBAR_PAINTER)
     [m_scrollbarPainterController.get() contentAreaWillDraw];
 #endif
@@ -619,6 +632,8 @@
 
 void ScrollAnimatorMac::mouseEnteredContentArea() const
 {
+    if (!scrollableArea()->isOnActivePage())
+        return;
 #if USE(SCROLLBAR_PAINTER)
     [m_scrollbarPainterController.get() mouseEnteredContentArea];
 #endif
@@ -626,6 +641,8 @@
 
 void ScrollAnimatorMac::mouseExitedContentArea() const
 {
+    if (!scrollableArea()->isOnActivePage())
+        return;
 #if USE(SCROLLBAR_PAINTER)
     [m_scrollbarPainterController.get() mouseExitedContentArea];
 #endif
@@ -633,6 +650,8 @@
 
 void ScrollAnimatorMac::mouseMovedInContentArea() const
 {
+    if (!scrollableArea()->isOnActivePage())
+        return;
 #if USE(SCROLLBAR_PAINTER)
     [m_scrollbarPainterController.get() mouseMovedInContentArea];
 #endif
@@ -640,6 +659,8 @@
 
 void ScrollAnimatorMac::willStartLiveResize()
 {
+    if (!scrollableArea()->isOnActivePage())
+        return;
 #if USE(SCROLLBAR_PAINTER)
     [m_scrollbarPainterController.get() startLiveResize];
 #endif
@@ -647,6 +668,8 @@
 
 void ScrollAnimatorMac::contentsResized() const
 {
+    if (!scrollableArea()->isOnActivePage())
+        return;
 #if USE(SCROLLBAR_PAINTER)
     [m_scrollbarPainterController.get() contentAreaDidResize];
 #endif
@@ -654,6 +677,8 @@
 
 void ScrollAnimatorMac::willEndLiveResize()
 {
+    if (!scrollableArea()->isOnActivePage())
+        return;
 #if USE(SCROLLBAR_PAINTER)
     [m_scrollbarPainterController.get() endLiveResize];
 #endif
@@ -661,6 +686,8 @@
 
 void ScrollAnimatorMac::contentAreaDidShow() const
 {
+    if (!scrollableArea()->isOnActivePage())
+        return;
 #if USE(SCROLLBAR_PAINTER)
     [m_scrollbarPainterController.get() windowOrderedIn];
 #endif
@@ -668,6 +695,8 @@
 
 void ScrollAnimatorMac::contentAreaDidHide() const
 {
+    if (!scrollableArea()->isOnActivePage())
+        return;
 #if USE(SCROLLBAR_PAINTER)
     [m_scrollbarPainterController.get() windowOrderedOut];
 #endif
@@ -675,6 +704,8 @@
 
 void ScrollAnimatorMac::didBeginScrollGesture() const
 {
+    if (!scrollableArea()->isOnActivePage())
+        return;
 #if USE(SCROLLBAR_PAINTER)
     [m_scrollbarPainterController.get() beginScrollGesture];
 #endif
@@ -682,6 +713,8 @@
 
 void ScrollAnimatorMac::didEndScrollGesture() const
 {
+    if (!scrollableArea()->isOnActivePage())
+        return;
 #if USE(SCROLLBAR_PAINTER)
     [m_scrollbarPainterController.get() endScrollGesture];
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to