File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -300,7 +300,9 @@ void ScenesManager::resetCurrentScene() {
300300
301301void ScenesManager::unloadCurrentScene () {
302302 m_currentScene = std::make_unique<Scene>(Scene{.info = SceneInfo{.name = _ (" scenes.default_scene_name" )}});
303- if (auto nodeEditor = WindowManager::instance ().getWindowAs <NodeEditorWindow>(" node_editor" )) {
304- (*nodeEditor)->clearGraph ();
303+ if (WindowManager::instance ().isInitialized ()) {
304+ if (auto nodeEditor = WindowManager::instance ().getWindowAs <NodeEditorWindow>(" node_editor" )) {
305+ (*nodeEditor)->clearGraph ();
306+ }
305307 }
306308}
Original file line number Diff line number Diff line change @@ -508,4 +508,5 @@ void ImguiHook::Remove() {
508508 ImGui_ImplWin32_Shutdown ();
509509 ImGui::DestroyContext ();
510510 MH_DisableHook (MH_ALL_HOOKS);
511+ m_bInitialized = false ;
511512}
Original file line number Diff line number Diff line change @@ -35,6 +35,8 @@ void ImGuiHook() {
3535}
3636
3737void ImGuiHookRemove () {
38+ if (!ImguiHook::m_bInitialized)
39+ return ;
3840 ImguiHook::Remove ();
3941 LDYOM_INFO (" ImGui hook removed" );
4042}
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ class WindowManager {
5858
5959 void initialize ();
6060 void shutdown () noexcept ;
61+ bool isInitialized () const noexcept { return m_initialized; }
6162
6263 WindowManager (const WindowManager&) = delete ;
6364 WindowManager& operator =(const WindowManager&) = delete ;
You can’t perform that action at this time.
0 commit comments