Changeset 258048 in webkit


Ignore:
Timestamp:
Mar 6, 2020 6:25:29 PM (4 years ago)
Author:
Simon Fraser
Message:

Flaky Test: editing/spelling/spellcheck-async.html
https://bugs.webkit.org/show_bug.cgi?id=160571

Reviewed by Tim Horton.

The old code called -performSelector:target:... with an autoreleased target,
and nothing keeps the target alive until the call to -perform on the main thread.

Change this to a block which copies in a RetainPtr<> to make ownership clearer
and fix the crash.

  • WebCoreSupport/WebEditorClient.mm:

(WebEditorClient::requestCheckingOfString):

Location:
trunk/Source/WebKitLegacy/mac
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r258040 r258048  
     12020-03-06  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Flaky Test: editing/spelling/spellcheck-async.html
     4        https://bugs.webkit.org/show_bug.cgi?id=160571
     5
     6        Reviewed by Tim Horton.
     7       
     8        The old code called -performSelector:target:... with an autoreleased target,
     9        and nothing keeps the target alive until the call to -perform on the main thread.
     10
     11        Change this to a block which copies in a RetainPtr<> to make ownership clearer
     12        and fix the crash.
     13
     14        * WebCoreSupport/WebEditorClient.mm:
     15        (WebEditorClient::requestCheckingOfString):
     16
    1172020-03-06  Jer Noble  <jer.noble@apple.com>
    218
  • trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm

    r256948 r258048  
    12591259    NSDictionary *options = @{ NSTextCheckingInsertionPointKey :  [NSNumber numberWithUnsignedInteger:insertionPointFromCurrentSelection(currentSelection)] };
    12601260    [[NSSpellChecker sharedSpellChecker] requestCheckingOfString:m_textCheckingRequest->data().text() range:range types:NSTextCheckingAllSystemTypes options:options inSpellDocumentWithTag:0 completionHandler:^(NSInteger, NSArray* results, NSOrthography*, NSInteger) {
    1261             [currentLoop performSelector:@selector(perform)
    1262                                   target:[[[WebEditorSpellCheckResponder alloc] initWithClient:this sequence:sequence results:results] autorelease]
    1263                                 argument:nil order:0 modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
     1261        RetainPtr<WebEditorSpellCheckResponder> responder = adoptNS([[WebEditorSpellCheckResponder alloc] initWithClient:this sequence:sequence results:results]);
     1262        [currentLoop performBlock:^{
     1263            [responder perform];
    12641264        }];
     1265    }];
    12651266#endif
    12661267}
Note: See TracChangeset for help on using the changeset viewer.