From 42a4b4f195044df01a0ca27ab4b7706072b9891e Mon Sep 17 00:00:00 2001 From: praydog Date: Fri, 3 Nov 2023 17:29:24 -0700 Subject: [PATCH] Fix crash with Begin/EndChild behavior --- src/Framework.cpp | 3 ++- src/mods/UObjectHook.cpp | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Framework.cpp b/src/Framework.cpp index 29fc98f5..e33b4585 100644 --- a/src/Framework.cpp +++ b/src/Framework.cpp @@ -1267,7 +1267,8 @@ void Framework::draw_ui() { ImGui::SetNextWindowFocus(); } - if (ImGui::BeginChild("UEVRRightPane", ImVec2(0, 0), true, ImGuiWindowFlags_::ImGuiWindowFlags_AlwaysUseWindowPadding)) { + ImGui::BeginChild("UEVRRightPane", ImVec2(0, 0), true, ImGuiWindowFlags_::ImGuiWindowFlags_AlwaysUseWindowPadding); + { ImGui::BeginGroup(); if (m_sidebar_state.selected_entry > 0) { diff --git a/src/mods/UObjectHook.cpp b/src/mods/UObjectHook.cpp index 32c8a117..6ce226f7 100644 --- a/src/mods/UObjectHook.cpp +++ b/src/mods/UObjectHook.cpp @@ -1329,13 +1329,14 @@ void UObjectHook::on_draw_ui() { } const auto wide_filter = utility::widen(filter); - - bool made_child = ImGui::BeginChild("Objects by class entries", ImVec2(0, 0), true, ImGuiWindowFlags_::ImGuiWindowFlags_HorizontalScrollbar); + const bool made_child = ImGui::BeginChild("Objects by class entries", ImVec2(0, 0), true, ImGuiWindowFlags_::ImGuiWindowFlags_HorizontalScrollbar); utility::ScopeGuard sg{[made_child]() { - if (made_child) { + //if (made_child) { + // well apparently BeginChild doesn't care about if it returned true or not so... + // TODO: check this every time we update imgui? ImGui::EndChild(); - } + //} }}; for (auto uclass : m_sorted_classes) {