Changeset 77970 in webkit


Ignore:
Timestamp:
Feb 8, 2011 2:11:34 PM (13 years ago)
Author:
Beth Dakin
Message:

Fix for <rdar://problem/8953365> CrashTracer: 14
crashes in WebProcess at com.apple.WebCore:
-[ScrollKnobAnimation setCurrentProgress:] + 258

Reviewed by Darin Adler.

This crash seems to happen when the animation is running
and a window is closed. If the ScrollAnimator is destroyed,
delegate calls for the animation can still run, so we have
to make sure we inform the delegates when the ScrollAnimator
is gone, and then we have to null-check it before we do
anything with it.

Remove scrollbarPainterDelegate() since it's not used anymore.

  • platform/mac/ScrollAnimatorMac.h:
  • platform/mac/ScrollAnimatorMac.mm:


Add null-checks for _animator
(-[ScrollbarPartAnimation setCurrentProgress:]):
(-[ScrollbarPartAnimation scrollAnimatorDestroyed]):
(-[ScrollbarPainterDelegate scrollerImp:animateKnobAlphaTo:duration:]):
(-[ScrollbarPainterDelegate scrollerImp:animateTrackAlphaTo:duration:]):
(-[ScrollbarPainterDelegate scrollerImp:overlayScrollerStateChangedTo:]):

New function to inform the delegates that the ScrollAnimator
is being destroyed.
(-[ScrollbarPainterDelegate scrollAnimatorDestroyed]):
(WebCore::ScrollAnimatorMac::~ScrollAnimatorMac):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r77963 r77970  
     12011-02-08  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Fix for <rdar://problem/8953365> CrashTracer: 14
     6        crashes in WebProcess at com.apple.WebCore:
     7        -[ScrollKnobAnimation setCurrentProgress:] + 258
     8
     9        This crash seems to happen when the animation is running
     10        and a window is closed. If the ScrollAnimator is destroyed,
     11        delegate calls for the animation can still run, so we have
     12        to make sure we inform the delegates when the ScrollAnimator
     13        is gone, and then we have to null-check it before we do
     14        anything with it.
     15
     16        Remove scrollbarPainterDelegate() since it's not used anymore.
     17        * platform/mac/ScrollAnimatorMac.h:
     18        * platform/mac/ScrollAnimatorMac.mm:
     19       
     20        Add null-checks for _animator
     21        (-[ScrollbarPartAnimation setCurrentProgress:]):
     22        (-[ScrollbarPartAnimation scrollAnimatorDestroyed]):
     23        (-[ScrollbarPainterDelegate scrollerImp:animateKnobAlphaTo:duration:]):
     24        (-[ScrollbarPainterDelegate scrollerImp:animateTrackAlphaTo:duration:]):
     25        (-[ScrollbarPainterDelegate scrollerImp:overlayScrollerStateChangedTo:]):
     26       
     27        New function to inform the delegates that the ScrollAnimator
     28        is being destroyed.
     29        (-[ScrollbarPainterDelegate scrollAnimatorDestroyed]):
     30        (WebCore::ScrollAnimatorMac::~ScrollAnimatorMac):
     31
    1322011-02-08  Adam Barth  <abarth@webkit.org>
    233
  • trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h

    r77876 r77970  
    7171    void immediateScrollByDeltaX(float deltaX);
    7272    void immediateScrollByDeltaY(float deltaY);
    73 
    74     id scrollbarPainterDelegate();
    7573   
    7674private:
  • trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm

    r77910 r77970  
    279279    [super setCurrentProgress:progress];
    280280
     281    if (!_animator)
     282        return;
     283
    281284    CGFloat currentAlpha;
    282285    if (_initialAlpha > _newAlpha)
     
    297300}
    298301
     302- (void)scrollAnimatorDestroyed
     303{
     304    _animator = 0;
     305}
     306
    299307@end
    300308
     
    319327- (void)scrollerImp:(id)scrollerImp animateTrackAlphaTo:(CGFloat)newTrackAlpha duration:(NSTimeInterval)duration;
    320328- (void)scrollerImp:(id)scrollerImp overlayScrollerStateChangedTo:(NSUInteger)newOverlayScrollerState;
     329
     330- (void)scrollAnimatorDestroyed;
    321331
    322332@end
     
    368378- (void)scrollerImp:(id)scrollerImp animateKnobAlphaTo:(CGFloat)newKnobAlpha duration:(NSTimeInterval)duration
    369379{
     380    if (!_animator)
     381        return;
     382
    370383    WKScrollbarPainterRef scrollerPainter = (WKScrollbarPainterRef)scrollerImp;
    371384    if (newKnobAlpha == wkScrollbarPainterKnobAlpha(scrollerPainter))
     
    380393- (void)scrollerImp:(id)scrollerImp animateTrackAlphaTo:(CGFloat)newTrackAlpha duration:(NSTimeInterval)duration
    381394{
     395    if (!_animator)
     396        return;
     397
    382398    WKScrollbarPainterRef scrollerPainter = (WKScrollbarPainterRef)scrollerImp;
    383399    if (newTrackAlpha == wkScrollbarPainterTrackAlpha(scrollerPainter))
     
    392408- (void)scrollerImp:(id)scrollerImp overlayScrollerStateChangedTo:(NSUInteger)newOverlayScrollerState
    393409{
     410    if (!_animator)
     411        return;
     412
    394413    WKScrollbarPainterRef scrollbarPainter = (WKScrollbarPainterRef)scrollerImp;
    395414    wkScrollbarPainterSetOverlayState(scrollbarPainter, newOverlayScrollerState);
     
    403422
    404423    }
     424}
     425
     426- (void)scrollAnimatorDestroyed
     427{
     428    _animator = 0;
     429    [_verticalKnobAnimation.get() scrollAnimatorDestroyed];
     430    [_horizontalKnobAnimation.get() scrollAnimatorDestroyed];
     431    [_verticalTrackAnimation.get() scrollAnimatorDestroyed];
     432    [_horizontalTrackAnimation.get() scrollAnimatorDestroyed];
    405433}
    406434
     
    440468#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
    441469    [(id)m_scrollbarPainterController.get() setDelegate:nil];
    442 #endif
    443 }
    444 
    445 id ScrollAnimatorMac::scrollbarPainterDelegate()
    446 {
    447 #if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
    448     return m_scrollbarPainterDelegate.get();
    449 #else
    450     return nil;
     470    [(id)m_scrollbarPainterDelegate.get() scrollAnimatorDestroyed];
    451471#endif
    452472}
Note: See TracChangeset for help on using the changeset viewer.