diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 4234662d31..cac6be3658 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -912,6 +912,15 @@ public: mThread = std::thread([this]{ threadBody(); }); }; + ~LuaWorker() + { + if (mThread && mThread->joinable()) + { + Log(Debug::Error) << "Unexpected destruction of LuaWorker; likely there is an unhandled exception in the main thread."; + join(); + } + } + void allowUpdate() { if (!mThread)