mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-12 16:15:20 +02:00
GUIFormspecMenu: Fix race condition between quit event and cleanup in Game (#14010)
To not instantly free GUIFormSpec upon close/quit, Game periodically cleans up the remaining instance on the next frame. When a new formspec is received and processed after closing the previous formspec but before the cleanup in Game, the formspec would be closed regardless. This now re-creates the formspec when the old one is already pending for removal.
This commit is contained in:
@@ -4124,6 +4124,7 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
|
||||
break;
|
||||
|
||||
if (formspec->getReferenceCount() == 1) {
|
||||
// See GUIFormSpecMenu::create what refcnt = 1 means
|
||||
m_game_ui->deleteFormspec();
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user