Title: [230624] trunk/Tools
- Revision
- 230624
- Author
- carlo...@webkit.org
- Date
- 2018-04-13 00:26:59 -0700 (Fri, 13 Apr 2018)
Log Message
[GLIB] Tests WTF_RefPtr.ReleaseInNonMainThread and WTF_RefPtr.ReleaseInNonMainThreadDestroyInMainThread are crashing since they were added
https://bugs.webkit.org/show_bug.cgi?id=184531
Reviewed by Michael Catanzaro.
It's not a bug in WebKit, but in the tests. The problem is that those tests are using RunLoop::main() but main
run loop hasn't been initialized. ReleaseInNonMainThread doesn't really need to initialize the main run loop if
we change Util::run() to always use RunLop::current() instead of RunLoop::main(). But
ReleaseInNonMainThreadDestroyInMainThread ends up scheduling a task to the main thread, and the generic
implementation fo that uses RunLoop::main(), so we need to initialize the main loop in this case.
* TestWebKitAPI/Tests/WTF/RefPtr.cpp:
(TestWebKitAPI::TEST): Call RunLoop::initializeMainRunLoop().
* TestWebKitAPI/glib/UtilitiesGLib.cpp:
(TestWebKitAPI::Util::run): Use RunLop::current() to stop the current run loop.
(TestWebKitAPI::Util::sleep): Ditto.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (230623 => 230624)
--- trunk/Tools/ChangeLog 2018-04-13 06:52:36 UTC (rev 230623)
+++ trunk/Tools/ChangeLog 2018-04-13 07:26:59 UTC (rev 230624)
@@ -1,3 +1,22 @@
+2018-04-13 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [GLIB] Tests WTF_RefPtr.ReleaseInNonMainThread and WTF_RefPtr.ReleaseInNonMainThreadDestroyInMainThread are crashing since they were added
+ https://bugs.webkit.org/show_bug.cgi?id=184531
+
+ Reviewed by Michael Catanzaro.
+
+ It's not a bug in WebKit, but in the tests. The problem is that those tests are using RunLoop::main() but main
+ run loop hasn't been initialized. ReleaseInNonMainThread doesn't really need to initialize the main run loop if
+ we change Util::run() to always use RunLop::current() instead of RunLoop::main(). But
+ ReleaseInNonMainThreadDestroyInMainThread ends up scheduling a task to the main thread, and the generic
+ implementation fo that uses RunLoop::main(), so we need to initialize the main loop in this case.
+
+ * TestWebKitAPI/Tests/WTF/RefPtr.cpp:
+ (TestWebKitAPI::TEST): Call RunLoop::initializeMainRunLoop().
+ * TestWebKitAPI/glib/UtilitiesGLib.cpp:
+ (TestWebKitAPI::Util::run): Use RunLop::current() to stop the current run loop.
+ (TestWebKitAPI::Util::sleep): Ditto.
+
2018-04-12 Zalan Bujtas <za...@apple.com>
[LayoutReloaded] Add support for incremental layout
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/RefPtr.cpp (230623 => 230624)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/RefPtr.cpp 2018-04-13 06:52:36 UTC (rev 230623)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/RefPtr.cpp 2018-04-13 07:26:59 UTC (rev 230624)
@@ -33,6 +33,7 @@
#include <wtf/NeverDestroyed.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
+#include <wtf/RunLoop.h>
#include <wtf/ThreadSafeRefCounted.h>
#include <wtf/Threading.h>
@@ -577,6 +578,7 @@
TEST(WTF_RefPtr, ReleaseInNonMainThreadDestroyInMainThread)
{
+ RunLoop::initializeMainRunLoop();
done = false;
Thread::create("", [object = MainThreadSafeRefCountedObject::create()] { });
TestWebKitAPI::Util::run(&done);
Modified: trunk/Tools/TestWebKitAPI/glib/UtilitiesGLib.cpp (230623 => 230624)
--- trunk/Tools/TestWebKitAPI/glib/UtilitiesGLib.cpp 2018-04-13 06:52:36 UTC (rev 230623)
+++ trunk/Tools/TestWebKitAPI/glib/UtilitiesGLib.cpp 2018-04-13 07:26:59 UTC (rev 230624)
@@ -37,7 +37,7 @@
g_idle_add([](gpointer userData) -> gboolean {
bool* done = static_cast<bool*>(userData);
if (*done)
- RunLoop::main().stop();
+ RunLoop::current().stop();
return !*done;
}, done);
@@ -58,7 +58,7 @@
RunLoop::main().stop();
return G_SOURCE_REMOVE;
}, nullptr);
- RunLoop::main().stop();
+ RunLoop::current().stop();
}
} // namespace Util
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes