Title: [189017] trunk/Tools
Revision
189017
Author
[email protected]
Date
2015-08-27 02:37:12 -0700 (Thu, 27 Aug 2015)

Log Message

Fix GTK+ WTR crashes in initializeMainRunLoop()

Rubber-stamped by Žan Doberšek.

Initialize threading and main thread before
RunLoop::initializeMainRunLoop(), since the GLib implementation of
the RunLoop uses isMainThread() to decide whether to create a new
GMainContext or use the default one. Also use RunLoop::run() and
::stop() instead of gtk_main/quit.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
* WebKitTestRunner/gtk/TestControllerGtk.cpp:
(WTR::TestController::notifyDone):
(WTR::TestController::platformRunUntil):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (189016 => 189017)


--- trunk/Tools/ChangeLog	2015-08-27 09:16:01 UTC (rev 189016)
+++ trunk/Tools/ChangeLog	2015-08-27 09:37:12 UTC (rev 189017)
@@ -1,3 +1,21 @@
+2015-08-27  Carlos Garcia Campos  <[email protected]>
+
+        Fix GTK+ WTR crashes in initializeMainRunLoop()
+
+        Rubber-stamped by Žan Doberšek.
+
+        Initialize threading and main thread before
+        RunLoop::initializeMainRunLoop(), since the GLib implementation of
+        the RunLoop uses isMainThread() to decide whether to create a new
+        GMainContext or use the default one. Also use RunLoop::run() and
+        ::stop() instead of gtk_main/quit.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::initialize):
+        * WebKitTestRunner/gtk/TestControllerGtk.cpp:
+        (WTR::TestController::notifyDone):
+        (WTR::TestController::platformRunUntil):
+
 2015-08-27  Filip Pizlo  <[email protected]>
 
         Unreviewed, further shorten a test that times out because it's very long

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (189016 => 189017)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2015-08-27 09:16:01 UTC (rev 189016)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2015-08-27 09:37:12 UTC (rev 189017)
@@ -54,8 +54,10 @@
 #include <algorithm>
 #include <cstdio>
 #include <ctype.h>
+#include <runtime/InitializeThreading.h>
 #include <stdlib.h>
 #include <string>
+#include <wtf/MainThread.h>
 #include <wtf/RunLoop.h>
 #include <wtf/text/CString.h>
 
@@ -313,6 +315,8 @@
 
 void TestController::initialize(int argc, const char* argv[])
 {
+    JSC::initializeThreading();
+    WTF::initializeMainThread();
     RunLoop::initializeMainRunLoop();
 
     platformInitialize();

Modified: trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp (189016 => 189017)


--- trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp	2015-08-27 09:16:01 UTC (rev 189016)
+++ trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp	2015-08-27 09:37:12 UTC (rev 189017)
@@ -30,6 +30,7 @@
 #include "PlatformWebView.h"
 #include <gtk/gtk.h>
 #include <wtf/Platform.h>
+#include <wtf/RunLoop.h>
 #include <wtf/glib/GMainLoopSource.h>
 #include <wtf/glib/GUniquePtr.h>
 #include <wtf/text/WTFString.h>
@@ -40,8 +41,8 @@
 
 void TestController::notifyDone()
 {
-    gtk_main_quit();
     timeoutSource.cancel();
+    RunLoop::main().stop();
 }
 
 void TestController::platformInitialize()
@@ -62,11 +63,11 @@
     if (timeout > 0) {
         timeoutSource.scheduleAfterDelay("[WTR] Test timeout source", [] {
             fprintf(stderr, "FAIL: TestControllerRunLoop timed out.\n");
-            gtk_main_quit();
+            RunLoop::main().stop();
         }, std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>(timeout)));
     } else
         timeoutSource.cancel();
-    gtk_main();
+    RunLoop::main().run();
 }
 
 static char* getEnvironmentVariableAsUTF8String(const char* variableName)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to