File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -297,6 +297,9 @@ namespace RTE {
297
297
int ActivityMan::StartActivity (Activity *activity) {
298
298
RTEAssert (activity, " Trying to start a null activity!" );
299
299
300
+ g_ThreadMan.GetPriorityThreadPool ().wait_for_tasks ();
301
+ g_ThreadMan.GetBackgroundThreadPool ().wait_for_tasks ();
302
+
300
303
// Stop all music played by the current activity. It will be re-started by the new Activity.
301
304
g_AudioMan.StopMusic ();
302
305
@@ -442,6 +445,9 @@ namespace RTE {
442
445
void ActivityMan::EndActivity () const {
443
446
// TODO: Set the activity pointer to nullptr so it doesn't return junk after being destructed. Do it here, or wherever works without crashing.
444
447
if (m_Activity) {
448
+ g_ThreadMan.GetPriorityThreadPool ().wait_for_tasks ();
449
+ g_ThreadMan.GetBackgroundThreadPool ().wait_for_tasks ();
450
+
445
451
m_Activity->End ();
446
452
g_ConsoleMan.PrintString (" SYSTEM: Activity \" " + m_Activity->GetPresetName () + " \" was ended" );
447
453
} else {
You can’t perform that action at this time.
0 commit comments