From a8143b6d0c0613b2b44b97397540601699681da5 Mon Sep 17 00:00:00 2001 From: shweet Date: Fri, 2 Jan 2026 03:42:43 -0500 Subject: [PATCH] Fixed random crashing issue --- src/imgui/dockspace.cpp | 1 + src/imgui/taskbar.cpp | 2 +- src/imgui/window/animation_preview.cpp | 4 +--- src/imgui/window/animations.cpp | 2 +- src/imgui/window/spritesheet_editor.cpp | 2 +- src/imgui/window/welcome.cpp | 2 ++ src/state.cpp | 2 ++ 7 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/imgui/dockspace.cpp b/src/imgui/dockspace.cpp index 8e12bf3..52626bd 100644 --- a/src/imgui/dockspace.cpp +++ b/src/imgui/dockspace.cpp @@ -14,6 +14,7 @@ namespace anm2ed::imgui auto viewport = ImGui::GetMainViewport(); auto windowHeight = viewport->Size.y - taskbar.height - documents.height; + if (windowHeight < 1.0f) windowHeight = 1.0f; ImGui::SetNextWindowViewport(viewport->ID); ImGui::SetNextWindowPos(ImVec2(viewport->Pos.x, viewport->Pos.y + taskbar.height + documents.height)); diff --git a/src/imgui/taskbar.cpp b/src/imgui/taskbar.cpp index 6c2ac6a..3c8dd26 100644 --- a/src/imgui/taskbar.cpp +++ b/src/imgui/taskbar.cpp @@ -237,4 +237,4 @@ namespace anm2ed::imgui if (shortcut(manager.chords[SHORTCUT_SAVE_AS], shortcut::GLOBAL)) dialog.file_save(Dialog::ANM2_SAVE); if (shortcut(manager.chords[SHORTCUT_EXIT], shortcut::GLOBAL)) isQuitting = true; } -} +} \ No newline at end of file diff --git a/src/imgui/window/animation_preview.cpp b/src/imgui/window/animation_preview.cpp index 6f28636..01f43f4 100644 --- a/src/imgui/window/animation_preview.cpp +++ b/src/imgui/window/animation_preview.cpp @@ -898,14 +898,11 @@ namespace anm2ed::imgui ImGui::EndPopup(); } - ImGui::End(); manager.progressPopup.trigger(); if (ImGui::BeginPopupModal(manager.progressPopup.label(), &manager.progressPopup.isOpen, ImGuiWindowFlags_NoResize)) { - if (!animation) return; - auto& start = manager.recordingStart; auto& end = manager.recordingEnd; auto progress = (playback.time - start) / (end - start); @@ -946,5 +943,6 @@ namespace anm2ed::imgui } settings.previewStartZoom = zoom; + ImGui::End(); } } diff --git a/src/imgui/window/animations.cpp b/src/imgui/window/animations.cpp index 6dcd285..a5f37dd 100644 --- a/src/imgui/window/animations.cpp +++ b/src/imgui/window/animations.cpp @@ -466,7 +466,7 @@ namespace anm2ed::imgui ImGui::EndPopup(); } - ImGui::End(); } + ImGui::End(); } } \ No newline at end of file diff --git a/src/imgui/window/spritesheet_editor.cpp b/src/imgui/window/spritesheet_editor.cpp index b19b19d..53302bf 100644 --- a/src/imgui/window/spritesheet_editor.cpp +++ b/src/imgui/window/spritesheet_editor.cpp @@ -518,7 +518,6 @@ namespace anm2ed::imgui ImGui::EndPopup(); } - ImGui::End(); if (!document.isSpritesheetEditorSet) { @@ -532,5 +531,6 @@ namespace anm2ed::imgui settings.editorSize = size; settings.editorStartZoom = zoom; + ImGui::End(); } } diff --git a/src/imgui/window/welcome.cpp b/src/imgui/window/welcome.cpp index 74a046d..2d546fa 100644 --- a/src/imgui/window/welcome.cpp +++ b/src/imgui/window/welcome.cpp @@ -14,6 +14,8 @@ namespace anm2ed::imgui { auto viewport = ImGui::GetMainViewport(); auto windowHeight = viewport->Size.y - taskbar.height - documents.height; + if (windowHeight < 1.0f) + windowHeight = 1.0f; ImGui::SetNextWindowViewport(viewport->ID); ImGui::SetNextWindowPos(ImVec2(viewport->Pos.x, viewport->Pos.y + taskbar.height + documents.height)); diff --git a/src/state.cpp b/src/state.cpp index c9fa2ee..89971d5 100644 --- a/src/state.cpp +++ b/src/state.cpp @@ -2,6 +2,8 @@ #include +#include + #include #include