Changeset 98178 in webkit


Ignore:
Timestamp:
Oct 21, 2011 6:15:20 PM (13 years ago)
Author:
Beth Dakin
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r98177 r98178  
     12011-10-21  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=70647
     4        Common but unreproducible crash under [ScrollbarPartAnimation setCurrentProgress:]
     5        -and corresponding-
     6        <rdar://problem/9542018>
     7
     8        Reviewed by Sam Weinig.
     9
     10        This patch implements two speculative fixes for this crash.
     11
     12        First, block exceptions around all of the code responsible for calling
     13        stopAnimation. If that code throws any exceptions, we want to make sure the other
     14        animations are still stopped.
     15        * platform/mac/ScrollAnimatorMac.mm:
     16        (-[WebScrollbarPartAnimation scrollAnimatorDestroyed]):
     17        (-[WebScrollbarPainterDelegate scrollAnimatorDestroyed]):
     18        (WebCore::ScrollAnimatorMac::~ScrollAnimatorMac):
     19
     20        Only send AppKit these notifications for active pages. I originally made these
     21        assertions, and I found that they were hit a surprising number of times. If we
     22        only send notifications for active pages, then we should greatly reduce and
     23        possibly eliminate our chances of hitting this crash.
     24        (WebCore::ScrollAnimatorMac::notifyPositionChanged):
     25        (WebCore::ScrollAnimatorMac::contentAreaWillPaint):
     26        (WebCore::ScrollAnimatorMac::mouseEnteredContentArea):
     27        (WebCore::ScrollAnimatorMac::mouseExitedContentArea):
     28        (WebCore::ScrollAnimatorMac::mouseMovedInContentArea):
     29        (WebCore::ScrollAnimatorMac::willStartLiveResize):
     30        (WebCore::ScrollAnimatorMac::contentsResized):
     31        (WebCore::ScrollAnimatorMac::willEndLiveResize):
     32        (WebCore::ScrollAnimatorMac::contentAreaDidShow):
     33        (WebCore::ScrollAnimatorMac::contentAreaDidHide):
     34        (WebCore::ScrollAnimatorMac::didBeginScrollGesture):
     35        (WebCore::ScrollAnimatorMac::didEndScrollGesture):
     36
    1372011-10-21  Mark Hahnenberg  <mhahnenberg@apple.com>
    238
  • trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm

    r97229 r98178  
    3030#include "ScrollAnimatorMac.h"
    3131
     32#include "BlockExceptions.h"
    3233#include "FloatPoint.h"
    3334#include "NSScrollerImpDetails.h"
     
    298299- (void)scrollAnimatorDestroyed
    299300{
     301    BEGIN_BLOCK_OBJC_EXCEPTIONS;
    300302    [self stopAnimation];
     303    END_BLOCK_OBJC_EXCEPTIONS;
    301304    _animator = 0;
    302305}
     
    332335- (void)cancelAnimations
    333336{
     337    BEGIN_BLOCK_OBJC_EXCEPTIONS;
    334338    [_verticalKnobAnimation.get() stopAnimation];
    335339    [_horizontalKnobAnimation.get() stopAnimation];
    336340    [_verticalTrackAnimation.get() stopAnimation];
    337341    [_horizontalTrackAnimation.get() stopAnimation];
     342    END_BLOCK_OBJC_EXCEPTIONS;
    338343}
    339344
     
    436441{
    437442    _animator = 0;
     443    BEGIN_BLOCK_OBJC_EXCEPTIONS;
    438444    [_verticalKnobAnimation.get() scrollAnimatorDestroyed];
    439445    [_horizontalKnobAnimation.get() scrollAnimatorDestroyed];
    440446    [_verticalTrackAnimation.get() scrollAnimatorDestroyed];
    441447    [_horizontalTrackAnimation.get() scrollAnimatorDestroyed];
     448    END_BLOCK_OBJC_EXCEPTIONS;
    442449}
    443450
     
    490497{
    491498#if USE(SCROLLBAR_PAINTER)
     499    BEGIN_BLOCK_OBJC_EXCEPTIONS;
    492500    [m_scrollbarPainterControllerDelegate.get() scrollAnimatorDestroyed];
    493501    [m_scrollbarPainterController.get() setDelegate:nil];
    494502    [m_scrollbarPainterDelegate.get() scrollAnimatorDestroyed];
    495503    [m_scrollAnimationHelperDelegate.get() scrollAnimatorDestroyed];
     504    END_BLOCK_OBJC_EXCEPTIONS;
    496505#endif
    497506}
     
    605614void ScrollAnimatorMac::notifyPositionChanged()
    606615{
     616    if (!scrollableArea()->isOnActivePage())
     617        return;
    607618#if USE(SCROLLBAR_PAINTER)
    608619    [m_scrollbarPainterController.get() contentAreaScrolled];
     
    613624void ScrollAnimatorMac::contentAreaWillPaint() const
    614625{
     626    if (!scrollableArea()->isOnActivePage())
     627        return;
    615628#if USE(SCROLLBAR_PAINTER)
    616629    [m_scrollbarPainterController.get() contentAreaWillDraw];
     
    620633void ScrollAnimatorMac::mouseEnteredContentArea() const
    621634{
     635    if (!scrollableArea()->isOnActivePage())
     636        return;
    622637#if USE(SCROLLBAR_PAINTER)
    623638    [m_scrollbarPainterController.get() mouseEnteredContentArea];
     
    627642void ScrollAnimatorMac::mouseExitedContentArea() const
    628643{
     644    if (!scrollableArea()->isOnActivePage())
     645        return;
    629646#if USE(SCROLLBAR_PAINTER)
    630647    [m_scrollbarPainterController.get() mouseExitedContentArea];
     
    634651void ScrollAnimatorMac::mouseMovedInContentArea() const
    635652{
     653    if (!scrollableArea()->isOnActivePage())
     654        return;
    636655#if USE(SCROLLBAR_PAINTER)
    637656    [m_scrollbarPainterController.get() mouseMovedInContentArea];
     
    641660void ScrollAnimatorMac::willStartLiveResize()
    642661{
     662    if (!scrollableArea()->isOnActivePage())
     663        return;
    643664#if USE(SCROLLBAR_PAINTER)
    644665    [m_scrollbarPainterController.get() startLiveResize];
     
    648669void ScrollAnimatorMac::contentsResized() const
    649670{
     671    if (!scrollableArea()->isOnActivePage())
     672        return;
    650673#if USE(SCROLLBAR_PAINTER)
    651674    [m_scrollbarPainterController.get() contentAreaDidResize];
     
    655678void ScrollAnimatorMac::willEndLiveResize()
    656679{
     680    if (!scrollableArea()->isOnActivePage())
     681        return;
    657682#if USE(SCROLLBAR_PAINTER)
    658683    [m_scrollbarPainterController.get() endLiveResize];
     
    662687void ScrollAnimatorMac::contentAreaDidShow() const
    663688{
     689    if (!scrollableArea()->isOnActivePage())
     690        return;
    664691#if USE(SCROLLBAR_PAINTER)
    665692    [m_scrollbarPainterController.get() windowOrderedIn];
     
    669696void ScrollAnimatorMac::contentAreaDidHide() const
    670697{
     698    if (!scrollableArea()->isOnActivePage())
     699        return;
    671700#if USE(SCROLLBAR_PAINTER)
    672701    [m_scrollbarPainterController.get() windowOrderedOut];
     
    676705void ScrollAnimatorMac::didBeginScrollGesture() const
    677706{
     707    if (!scrollableArea()->isOnActivePage())
     708        return;
    678709#if USE(SCROLLBAR_PAINTER)
    679710    [m_scrollbarPainterController.get() beginScrollGesture];
     
    683714void ScrollAnimatorMac::didEndScrollGesture() const
    684715{
     716    if (!scrollableArea()->isOnActivePage())
     717        return;
    685718#if USE(SCROLLBAR_PAINTER)
    686719    [m_scrollbarPainterController.get() endScrollGesture];
Note: See TracChangeset for help on using the changeset viewer.