Title: [250126] trunk/Source/WTF
Revision
250126
Author
commit-qu...@webkit.org
Date
2019-09-20 01:45:03 -0700 (Fri, 20 Sep 2019)

Log Message

UI process crash when using callOnMainThread() after the main thread dispatcher has been destroyed
https://bugs.webkit.org/show_bug.cgi?id=197266

Patch by Libor Bukata <libor.buk...@oracle.com> on 2019-09-20
Reviewed by Carlos Garcia Campos.

* wtf/generic/MainThreadGeneric.cpp:
(WTF::scheduleDispatchFunctionsOnMainThread):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (250125 => 250126)


--- trunk/Source/WTF/ChangeLog	2019-09-20 08:33:26 UTC (rev 250125)
+++ trunk/Source/WTF/ChangeLog	2019-09-20 08:45:03 UTC (rev 250126)
@@ -1,3 +1,13 @@
+2019-09-20  Libor Bukata  <libor.buk...@oracle.com>
+
+        UI process crash when using callOnMainThread() after the main thread dispatcher has been destroyed
+        https://bugs.webkit.org/show_bug.cgi?id=197266
+
+        Reviewed by Carlos Garcia Campos.
+
+        * wtf/generic/MainThreadGeneric.cpp:
+        (WTF::scheduleDispatchFunctionsOnMainThread):
+
 2019-09-17  Mark Lam  <mark....@apple.com>
 
         Use constexpr instead of const in symbol definitions that are obviously constexpr.

Modified: trunk/Source/WTF/wtf/generic/MainThreadGeneric.cpp (250125 => 250126)


--- trunk/Source/WTF/wtf/generic/MainThreadGeneric.cpp	2019-09-20 08:33:26 UTC (rev 250125)
+++ trunk/Source/WTF/wtf/generic/MainThreadGeneric.cpp	2019-09-20 08:45:03 UTC (rev 250126)
@@ -3,6 +3,7 @@
  * Copyright (C) 2007 Justin Haygood (jhayg...@reaktix.com)
  * Copyright (C) 2016 Konstantin Tokavev <annu...@yandex.ru>
  * Copyright (C) 2016 Yusuke Suzuki <utatane....@gmail.com>
+ * Copyright (C) 2019 Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -36,6 +37,7 @@
 #endif
 
 #include <wtf/RunLoop.h>
+#include <wtf/NeverDestroyed.h>
 #if USE(GLIB)
 #include <wtf/glib/RunLoopSourcePriority.h>
 #endif
@@ -101,8 +103,8 @@
 {
     // Use a RunLoop::Timer instead of RunLoop::dispatch() to be able to use a different priority and
     // avoid the double queue because dispatchOnMainThread also queues the functions.
-    static MainThreadDispatcher dispatcher;
-    dispatcher.schedule();
+    static NeverDestroyed<MainThreadDispatcher> dispatcher;
+    dispatcher.get().schedule();
 }
 
 } // namespace WTF
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to