ImGui cleanup order: prevent error on exit by performing ImGui::SFML::Shutdown() before window close
This commit is contained in:
parent
9ab618079a
commit
016ca693b5
1 changed files with 8 additions and 6 deletions
|
|
@ -124,16 +124,18 @@ void GameEngine::cleanup()
|
|||
McRFPy_API::game = nullptr;
|
||||
}
|
||||
|
||||
// Shutdown ImGui before closing window
|
||||
// Close window FIRST - ImGui-SFML requires window to be closed before Shutdown()
|
||||
// because Shutdown() destroys sf::Cursor objects that the window may reference.
|
||||
// See: modules/imgui-sfml/README.md - "Call ImGui::SFML::Shutdown() after window.close()"
|
||||
if (window && window->isOpen()) {
|
||||
window->close();
|
||||
}
|
||||
|
||||
// Shutdown ImGui AFTER window is closed to avoid X11 BadCursor errors
|
||||
if (imguiInitialized) {
|
||||
ImGui::SFML::Shutdown();
|
||||
imguiInitialized = false;
|
||||
}
|
||||
|
||||
// Force close the window if it's still open
|
||||
if (window && window->isOpen()) {
|
||||
window->close();
|
||||
}
|
||||
}
|
||||
|
||||
Scene* GameEngine::currentScene() { return scenes[scene]; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue