From c749d6a7dca1807459bab75fb0783b4649a066c8 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Wed, 25 Dec 2024 18:49:50 +0100 Subject: [PATCH] fix: Disable ImGui assert that causes random crashes on resize --- lib/third_party/imgui/imgui/source/imgui.cpp | 2 +- main/gui/source/window/window.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/third_party/imgui/imgui/source/imgui.cpp b/lib/third_party/imgui/imgui/source/imgui.cpp index 0816de389..e2506f4ea 100644 --- a/lib/third_party/imgui/imgui/source/imgui.cpp +++ b/lib/third_party/imgui/imgui/source/imgui.cpp @@ -15592,7 +15592,7 @@ void ImGui::SetCurrentViewport(ImGuiWindow* current_window, ImGuiViewportP* view return; g.CurrentDpiScale = viewport ? viewport->DpiScale : 1.0f; g.CurrentViewport = viewport; - IM_ASSERT(g.CurrentDpiScale > 0.0f && g.CurrentDpiScale < 99.0f); // Typical correct values would be between 1.0f and 4.0f + //IM_ASSERT(g.CurrentDpiScale > 0.0f && g.CurrentDpiScale < 99.0f); // Typical correct values would be between 1.0f and 4.0f //IMGUI_DEBUG_LOG_VIEWPORT("[viewport] SetCurrentViewport changed '%s' 0x%08X\n", current_window ? current_window->Name : NULL, viewport ? viewport->ID : 0); // Notify platform layer of viewport changes diff --git a/main/gui/source/window/window.cpp b/main/gui/source/window/window.cpp index f72a25ff8..b3cc5cece 100644 --- a/main/gui/source/window/window.cpp +++ b/main/gui/source/window/window.cpp @@ -529,17 +529,18 @@ namespace hex { } }; + std::string localizedName = name.get(); if (currPopup->isModal()) - createPopup(ImGui::BeginPopupModal(name, closeButton, flags)); + createPopup(ImGui::BeginPopupModal(localizedName.c_str(), closeButton, flags)); else - createPopup(ImGui::BeginPopup(name, flags)); + createPopup(ImGui::BeginPopup(localizedName.c_str(), flags)); - if (!ImGui::IsPopupOpen(name) && displayFrameCount < 5) { - ImGui::OpenPopup(name); + if (!ImGui::IsPopupOpen(localizedName.c_str()) && displayFrameCount < 5) { + ImGui::OpenPopup(localizedName.c_str()); } if (currPopup->shouldClose() || !open) { - log::debug("Closing popup '{}'", name); + log::debug("Closing popup '{}'", localizedName); positionSet = sizeSet = false; currPopup = nullptr;