summaryrefslogtreecommitdiff
path: root/Tests/LibCore/TestLibCoreStream.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-12-28 00:59:15 +0100
committerAndreas Kling <kling@serenityos.org>2021-12-28 01:02:35 +0100
commit5d55a42ded2a0376a8a2d90869e4d9e920fe40e2 (patch)
treecddb7d58028f00f46182aca8b2be3dfeadbbe86e /Tests/LibCore/TestLibCoreStream.cpp
parentbdd2dba77b3c6f9db209ec7d0976cb315cb80a26 (diff)
downloadserenity-5d55a42ded2a0376a8a2d90869e4d9e920fe40e2.zip
LibCore: Fix race conditions in TestLibCoreStream
It was possible for the "local_socket_read" and "local_socket_write" tests to fail because we had exited the EventLoop before BackgroundAction got around to invoking the completion callback. The crash happened when trying to deferred_invoke() on the background thread, calling Core::EventLoop::current() after said EventLoop had returned from exec(). Fix this by not passing a completion callback, since we didn't need one in the first place.
Diffstat (limited to 'Tests/LibCore/TestLibCoreStream.cpp')
-rw-r--r--Tests/LibCore/TestLibCoreStream.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Tests/LibCore/TestLibCoreStream.cpp b/Tests/LibCore/TestLibCoreStream.cpp
index ebfc49c176..2f1276b49c 100644
--- a/Tests/LibCore/TestLibCoreStream.cpp
+++ b/Tests/LibCore/TestLibCoreStream.cpp
@@ -333,7 +333,7 @@ TEST_CASE(local_socket_read)
return 0;
},
- [](int) {});
+ nullptr);
event_loop.exec();
::unlink("/tmp/test-socket");
@@ -372,7 +372,7 @@ TEST_CASE(local_socket_write)
return 0;
},
- [](int) {});
+ nullptr);
event_loop.exec();
::unlink("/tmp/test-socket");