Title: [258048] trunk/Source/WebKitLegacy/mac
Revision
258048
Author
[email protected]
Date
2020-03-06 18:25:29 -0800 (Fri, 06 Mar 2020)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (258047 => 258048)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2020-03-07 02:06:27 UTC (rev 258047)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2020-03-07 02:25:29 UTC (rev 258048)
@@ -1,3 +1,19 @@
+2020-03-06  Simon Fraser  <[email protected]>
+
+        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):
+
 2020-03-06  Jer Noble  <[email protected]>
 
         [GPUP] Convert CDMFactory away from platformStrategies() and use WebProcess settings instead

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm (258047 => 258048)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm	2020-03-07 02:06:27 UTC (rev 258047)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm	2020-03-07 02:25:29 UTC (rev 258048)
@@ -1258,10 +1258,11 @@
     NSRunLoop* currentLoop = [NSRunLoop currentRunLoop];
     NSDictionary *options = @{ NSTextCheckingInsertionPointKey :  [NSNumber numberWithUnsignedInteger:insertionPointFromCurrentSelection(currentSelection)] };
     [[NSSpellChecker sharedSpellChecker] requestCheckingOfString:m_textCheckingRequest->data().text() range:range types:NSTextCheckingAllSystemTypes options:options inSpellDocumentWithTag:0 completionHandler:^(NSInteger, NSArray* results, NSOrthography*, NSInteger) {
-            [currentLoop performSelector:@selector(perform) 
-                                  target:[[[WebEditorSpellCheckResponder alloc] initWithClient:this sequence:sequence results:results] autorelease]
-                                argument:nil order:0 modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
+        RetainPtr<WebEditorSpellCheckResponder> responder = adoptNS([[WebEditorSpellCheckResponder alloc] initWithClient:this sequence:sequence results:results]);
+        [currentLoop performBlock:^{
+            [responder perform];
         }];
+    }];
 #endif
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to