diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-03-01 12:31:55 +0100 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2022-03-01 12:31:55 +0100 |
commit | d678e6d830c96ae10f7666c3769c87b237d4ea19 (patch) | |
tree | 410c23e0576028513ae75af9b241f0d5887ed14f /test/buildtool/multithreading/task_system.test.cpp | |
parent | 7dc104bd038ab17a22a9d68b722404edd709efae (diff) | |
download | justbuild-d678e6d830c96ae10f7666c3769c87b237d4ea19.tar.gz |
Test TaskSystem: Fix read after free
Diffstat (limited to 'test/buildtool/multithreading/task_system.test.cpp')
-rw-r--r-- | test/buildtool/multithreading/task_system.test.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/buildtool/multithreading/task_system.test.cpp b/test/buildtool/multithreading/task_system.test.cpp index 8488417c..21e1ca6e 100644 --- a/test/buildtool/multithreading/task_system.test.cpp +++ b/test/buildtool/multithreading/task_system.test.cpp @@ -69,8 +69,10 @@ TEST_CASE("Side effects of tasks are reflected out of ts", "[task_system]") { SECTION("Lambda capturing `this` inside struct") { std::string ext_name{}; struct Wrapper { - TaskSystem ts{}; std::string name{}; + // ts must be second, otherwise name will get destroyed before the + // task system is finished. + TaskSystem ts{}; explicit Wrapper(std::string n) : name{std::move(n)} {} |