mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00: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:
parent
689aaf50b3
commit
321bcf5c44
2 changed files with 16 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue