From 2590cb90a42941a173ad033213e51b3880358651 Mon Sep 17 00:00:00 2001 From: Tristan Walter Date: Tue, 20 Jun 2023 01:14:06 +0200 Subject: [PATCH] * other crash --- Application/src/tracker/misc/RepeatedDeferral.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Application/src/tracker/misc/RepeatedDeferral.h b/Application/src/tracker/misc/RepeatedDeferral.h index da073665a..4111f7959 100644 --- a/Application/src/tracker/misc/RepeatedDeferral.h +++ b/Application/src/tracker/misc/RepeatedDeferral.h @@ -106,11 +106,12 @@ struct RepeatedDeferral { } void quit() { - if(not _terminate){ + { std::unique_lock guard(_mutex); _terminate = true; notify(); } + if(_updater && _updater->joinable()) _updater->join(); _updater = nullptr; @@ -132,7 +133,10 @@ struct RepeatedDeferral { } if(_next.empty()) - _new_item.wait(guard, [this]() {return not _next.empty(); }); + _new_item.wait(guard, [this]() {return not _next.empty() or _terminate; }); + + if(_terminate) + throw std::runtime_error("Terminated"); auto e = timer.elapsed(); {