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

Changeset 252729 in webkit


Ignore:
Timestamp:
Nov 20, 2019, 11:25:43 PM (7 years ago)
Author:
Conrad Shultz
Message:

Crash at com.apple.WebCore: -[WebRevealHighlight revealContext:drawRectsForItem:]
https://bugs.webkit.org/show_bug.cgi?id=204434

Reviewed by Megan Gardner.

_attributedString was not retained, leading to a potential use-after-dealloc. Fix
this by wrapping it in a RetainPtr. While we're here, remove explicit ivars and
property synthesis and copy the string during assignment.

Reveal functionality is currently not testable.

  • editing/cocoa/DictionaryLookup.mm:

(SOFT_LINK_CLASS_OPTIONAL):
(-[WebRevealHighlight initWithHighlightRect:useDefaultHighlight:attributedString:]):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r252726 r252729  
     12019-11-20  Conrad Shultz  <conrad_shultz@apple.com>
     2
     3        Crash at com.apple.WebCore: -[WebRevealHighlight revealContext:drawRectsForItem:]
     4        https://bugs.webkit.org/show_bug.cgi?id=204434
     5
     6        Reviewed by Megan Gardner.
     7
     8        _attributedString was not retained, leading to a potential use-after-dealloc. Fix
     9        this by wrapping it in a RetainPtr. While we're here, remove explicit ivars and
     10        property synthesis and copy the string during assignment.
     11
     12        Reveal functionality is currently not testable.
     13
     14        * editing/cocoa/DictionaryLookup.mm:
     15        (SOFT_LINK_CLASS_OPTIONAL):
     16        (-[WebRevealHighlight initWithHighlightRect:useDefaultHighlight:attributedString:]):
     17
    1182019-11-20  Fujii Hironori  <Hironori.Fujii@sony.com>
    219
  • trunk/Source/WebCore/editing/cocoa/DictionaryLookup.mm

    r247915 r252729  
    8080@private
    8181    Function<void()> _clearTextIndicator;
    82     NSRect _highlightRect;
    83     BOOL _useDefaultHighlight;
    84     NSAttributedString *_attributedString;
    8582}
    8683
    8784@property (nonatomic, readonly) NSRect highlightRect;
    8885@property (nonatomic, readonly) BOOL useDefaultHighlight;
    89 @property (nonatomic, readonly) NSAttributedString *attributedString;
     86@property (nonatomic, readonly) RetainPtr<NSAttributedString> attributedString;
    9087
    9188- (instancetype)initWithHighlightRect:(NSRect)highlightRect useDefaultHighlight:(BOOL)useDefaultHighlight attributedString:(NSAttributedString *) attributedString;
     
    9693@implementation WebRevealHighlight
    9794
    98 @synthesize highlightRect=_highlightRect;
    99 @synthesize useDefaultHighlight=_useDefaultHighlight;
    100 @synthesize attributedString=_attributedString;
    101 
    10295- (instancetype)initWithHighlightRect:(NSRect)highlightRect useDefaultHighlight:(BOOL)useDefaultHighlight attributedString:(NSAttributedString *) attributedString
    10396{
     
    107100    _highlightRect = highlightRect;
    108101    _useDefaultHighlight = useDefaultHighlight;
    109     _attributedString = attributedString;
     102    _attributedString = adoptNS([attributedString copy]);
    110103   
    111104    return self;
Note: See TracChangeset for help on using the changeset viewer.