⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 285431 in webkit


Ignore:
Timestamp:
Nov 8, 2021, 2:16:44 PM (5 years ago)
Author:
Wenson Hsieh
Message:

WKSyntheticTapGestureRecognizer's action targets should be weak pointers
​https://bugs.webkit.org/show_bug.cgi?id=232812

Reviewed by Tim Horton.

Make WKSyntheticTapGestureRecognizer robust against the case where it outlives its WKContentView, by making its
"reset", "gesture identified", and "gesture failed" targets weak pointers instead of raw pointers.

  • UIProcess/ios/WKSyntheticTapGestureRecognizer.mm:

(-[WKSyntheticTapGestureRecognizer lastTouchedScrollView]):

Drive-by fix: we can also make _lastTouchedScrollView use the weak ivar attribute instead of WeakObjCPtr,
now that
weak is enabled in WebKit2.

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r285424 r285431  
     12021-11-08  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        WKSyntheticTapGestureRecognizer's action targets should be weak pointers
     4        https://bugs.webkit.org/show_bug.cgi?id=232812
     5
     6        Reviewed by Tim Horton.
     7
     8        Make WKSyntheticTapGestureRecognizer robust against the case where it outlives its WKContentView, by making its
     9        "reset", "gesture identified", and "gesture failed" targets weak pointers instead of raw pointers.
     10
     11        * UIProcess/ios/WKSyntheticTapGestureRecognizer.mm:
     12        (-[WKSyntheticTapGestureRecognizer lastTouchedScrollView]):
     13
     14        Drive-by fix: we can also make `_lastTouchedScrollView` use the __weak ivar attribute instead of WeakObjCPtr,
     15        now that __weak is enabled in WebKit2.
     16
    1172021-11-08  Devin Rousso  <drousso@apple.com>
    218
  • trunk/Source/WebKit/UIProcess/ios/WKSyntheticTapGestureRecognizer.mm

    r258888 r285431  
    3131#import <UIKit/UIGestureRecognizerSubclass.h>
    3232#import <wtf/RetainPtr.h>
    33 #import <wtf/WeakObjCPtr.h>
    3433
    3534@implementation WKSyntheticTapGestureRecognizer {
    36     id _gestureIdentifiedTarget;
     35    __weak id _gestureIdentifiedTarget;
    3736    SEL _gestureIdentifiedAction;
    38     id _gestureFailedTarget;
     37    __weak id _gestureFailedTarget;
    3938    SEL _gestureFailedAction;
    40     id _resetTarget;
     39    __weak id _resetTarget;
    4140    SEL _resetAction;
    4241    RetainPtr<NSNumber> _lastActiveTouchIdentifier;
    43     WeakObjCPtr<UIScrollView> _lastTouchedScrollView;
     42    __weak UIScrollView *_lastTouchedScrollView;
    4443}
    4544
    … …  
    109108- (UIScrollView *)lastTouchedScrollView
    110109{
    111     return _lastTouchedScrollView.get().get();
     110    return _lastTouchedScrollView;
    112111}
    113112
Note: See TracChangeset for help on using the changeset viewer.