From 5ea23977f7464dbdfbf0a50a50d1da82ea7db578 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 29 May 2015 14:54:33 +0100 Subject: [PATCH] Fixed uninitialized fields in constructor - wouldn't have caused a problem (thanks Coverity!) --- imgui.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 0ac828109..db77e160e 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1150,6 +1150,10 @@ struct ImGuiDrawContext MenuBarOffsetX = 0.0f; StateStorage = NULL; LayoutType = ImGuiLayoutType_Vertical; + ItemWidth = 0.0f; + ButtonRepeat = false; + AllowKeyboardFocus = true; + TextWrapPos = 1.0f; ColorEditMode = ImGuiColorEditMode_RGB; memset(StackSizesBackup, 0, sizeof(StackSizesBackup)); @@ -1333,6 +1337,7 @@ struct ImGuiState ActiveIdIsAlive = false; ActiveIdIsJustActivated = false; ActiveIdIsFocusedOnly = false; + ActiveIdWindow = NULL; MovedWindow = NULL; SettingsDirtyTimer = 0.0f; DisableHideTextAfterDoubleHash = 0; @@ -3201,7 +3206,6 @@ bool ImGui::BeginPopupContextVoid(const char* str_id, int button) bool ImGui::BeginChild(const char* str_id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags) { ImGuiWindow* window = GetCurrentWindow(); - ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_ChildWindow; const ImVec2 content_max = window->Pos + ImGui::GetContentRegionMax(); @@ -3441,6 +3445,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_ g.CurrentWindowStack.push_back(window); SetCurrentWindow(window); CheckStacksSize(window, true); + IM_ASSERT(parent_window != NULL || !(flags & ImGuiWindowFlags_ChildWindow)); const int current_frame = ImGui::GetFrameCount(); bool window_was_visible = (window->LastFrameDrawn == current_frame - 1); // Not using !WasActive because the implicit "Debug" window would always toggle off->on @@ -10243,7 +10248,6 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref) filter.Draw("Filter colors", 200); ImGui::BeginChild("#colors", ImVec2(0, 300), true); - ImGui::ColorEditMode(edit_mode); for (int i = 0; i < ImGuiCol_COUNT; i++) {