Title: [268570] trunk/Source/WebKit
Revision
268570
Author
[email protected]
Date
2020-10-15 18:45:03 -0700 (Thu, 15 Oct 2020)

Log Message

v2: WebKit::XPCServiceEventHandler block should call exit() on the main thread
<https://webkit.org/b/217773>
<rdar://problem/70275659>

Reviewed by Geoff Garen.

* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
(WebKit::XPCServiceEventHandler):
- Use NSRunLoop instead of libdispatch to run code on the main
  thread since libdispatch can randomly pick a new main thread when
  exit() is called on the original main thread.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (268569 => 268570)


--- trunk/Source/WebKit/ChangeLog	2020-10-16 01:39:03 UTC (rev 268569)
+++ trunk/Source/WebKit/ChangeLog	2020-10-16 01:45:03 UTC (rev 268570)
@@ -1,3 +1,17 @@
+2020-10-15  David Kilzer  <[email protected]>
+
+        v2: WebKit::XPCServiceEventHandler block should call exit() on the main thread
+        <https://webkit.org/b/217773>
+        <rdar://problem/70275659>
+
+        Reviewed by Geoff Garen.
+
+        * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
+        (WebKit::XPCServiceEventHandler):
+        - Use NSRunLoop instead of libdispatch to run code on the main
+          thread since libdispatch can randomly pick a new main thread when
+          exit() is called on the original main thread.
+
 2020-10-15  Tim Horton  <[email protected]>
 
         iPhone apps and iPad apps linked before iOS 13 running on macOS get desktop UA unexpectedly

Modified: trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm (268569 => 268570)


--- trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm	2020-10-16 01:39:03 UTC (rev 268569)
+++ trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm	2020-10-16 01:45:03 UTC (rev 268570)
@@ -50,9 +50,9 @@
             if (event == XPC_ERROR_CONNECTION_INVALID || event == XPC_ERROR_TERMINATION_IMMINENT) {
                 RELEASE_LOG_FAULT(IPC, "Exiting: Received XPC event type: %s", event == XPC_ERROR_CONNECTION_INVALID ? "XPC_ERROR_CONNECTION_INVALID" : "XPC_ERROR_TERMINATION_IMMINENT");
                 // FIXME: Handle this case more gracefully.
-                dispatch_sync(dispatch_get_main_queue(), ^{
+                [[NSRunLoop mainRunLoop] performBlock:^{
                     exit(EXIT_FAILURE);
-                });
+                }];
             }
         } else {
             assert(type == XPC_TYPE_DICTIONARY);
@@ -77,9 +77,9 @@
                 InitializerFunction initializerFunctionPtr = reinterpret_cast<InitializerFunction>(CFBundleGetFunctionPointerForName(webKitBundle, entryPointFunctionName));
                 if (!initializerFunctionPtr) {
                     RELEASE_LOG_FAULT(IPC, "Exiting: Unable to find entry point in WebKit.framework with name: %s", [(__bridge NSString *)entryPointFunctionName UTF8String]);
-                    dispatch_sync(dispatch_get_main_queue(), ^{
+                    [[NSRunLoop mainRunLoop] performBlock:^{
                         exit(EXIT_FAILURE);
-                    });
+                    }];
                 }
 
                 auto reply = adoptOSObject(xpc_dictionary_create_reply(event));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to