Title: [101134] trunk/Source/_javascript_Core
Revision
101134
Author
[email protected]
Date
2011-11-24 05:27:57 -0800 (Thu, 24 Nov 2011)

Log Message

[Qt] REGRESSION(r101131): WTF::scheduleDispatchFunctionsOnMainThread() doesn't work reliably

Reviewed by Andreas Kling.

We must make sure that the MainThreadInvoker object lives in the gui thread. There are a few
ways of doing that and this fix seems like the least intrusive one by simply pushing the
invoker to the gui thread if it's not there already.

* wtf/qt/MainThreadQt.cpp:
(WTF::scheduleDispatchFunctionsOnMainThread):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (101133 => 101134)


--- trunk/Source/_javascript_Core/ChangeLog	2011-11-24 13:07:54 UTC (rev 101133)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-11-24 13:27:57 UTC (rev 101134)
@@ -1,3 +1,16 @@
+2011-11-24  Simon Hausmann  <[email protected]>
+
+        [Qt] REGRESSION(r101131): WTF::scheduleDispatchFunctionsOnMainThread() doesn't work reliably
+
+        Reviewed by Andreas Kling.
+
+        We must make sure that the MainThreadInvoker object lives in the gui thread. There are a few
+        ways of doing that and this fix seems like the least intrusive one by simply pushing the
+        invoker to the gui thread if it's not there already.
+
+        * wtf/qt/MainThreadQt.cpp:
+        (WTF::scheduleDispatchFunctionsOnMainThread):
+
 2011-11-24  Patrick Gansterer  <[email protected]>
 
         [Qt] Use QEvent for dispatchFunctionsFromMainThread()

Modified: trunk/Source/_javascript_Core/wtf/qt/MainThreadQt.cpp (101133 => 101134)


--- trunk/Source/_javascript_Core/wtf/qt/MainThreadQt.cpp	2011-11-24 13:07:54 UTC (rev 101133)
+++ trunk/Source/_javascript_Core/wtf/qt/MainThreadQt.cpp	2011-11-24 13:27:57 UTC (rev 101134)
@@ -69,7 +69,12 @@
 
 void scheduleDispatchFunctionsOnMainThread()
 {
-    QCoreApplication::postEvent(webkit_main_thread_invoker(), new QEvent(static_cast<QEvent::Type>(s_mainThreadInvokerEventType)));
+    QObject* invoker = webkit_main_thread_invoker();
+    if (invoker->thread() != QCoreApplication::instance()->thread()) {
+        ASSERT(invoker->thread() == QThread::currentThread());
+        invoker->moveToThread(QCoreApplication::instance()->thread());
+    }
+    QCoreApplication::postEvent(invoker, new QEvent(static_cast<QEvent::Type>(s_mainThreadInvokerEventType)));
 }
 
 bool isMainThread()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to