mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-01-16 22:08:28 +01:00
Pause renderer thread when needed in GameModel
This commit is contained in:
parent
12322bb382
commit
c842086309
@ -192,6 +192,7 @@ GameModel::~GameModel()
|
||||
prefs.Set("Decoration.Alpha", (int)colour.Alpha);
|
||||
}
|
||||
|
||||
view->PauseRendererThread();
|
||||
delete sim;
|
||||
delete ren;
|
||||
//if(activeTools)
|
||||
@ -760,6 +761,7 @@ void GameModel::SetSave(std::unique_ptr<SaveInfo> newSave, bool invertIncludePre
|
||||
auto *saveData = currentSave->GetGameSave();
|
||||
SaveToSimParameters(*saveData);
|
||||
sim->clear_sim();
|
||||
view->PauseRendererThread();
|
||||
ren->ClearAccumulation();
|
||||
sim->Load(saveData, !invertIncludePressure, { 0, 0 });
|
||||
// This save was created before logging existed
|
||||
@ -811,6 +813,7 @@ void GameModel::SetSaveFile(std::unique_ptr<SaveFile> newSave, bool invertInclud
|
||||
auto *saveData = currentFile->GetGameSave();
|
||||
SaveToSimParameters(*saveData);
|
||||
sim->clear_sim();
|
||||
view->PauseRendererThread();
|
||||
ren->ClearAccumulation();
|
||||
sim->Load(saveData, !invertIncludePressure, { 0, 0 });
|
||||
Client::Ref().OverwriteAuthorInfo(saveData->authors);
|
||||
|
@ -267,7 +267,7 @@ public:
|
||||
{
|
||||
return *rendererFrame;
|
||||
}
|
||||
// Call this before accessing Renderer "out of turn", e.g. from RenderView. This *does not*
|
||||
// Call this before accessing Renderer "out of turn", e.g. from RenderView or GameModel. This *does not*
|
||||
// include OptionsModel or Lua setting functions because they only access the RendererSettings
|
||||
// in GameModel, or Lua drawing functions because they only access Renderer in eventTraitSimGraphics
|
||||
// and *SimDraw events, and the renderer thread gets paused anyway if there are handlers
|
||||
|
Loading…
x
Reference in New Issue
Block a user