jvcleave / ofxImGui

Use ImGui in openFrameworks
293 stars 124 forks source link

Double clicking window bar causes IM_ASSERT #34

Open jvcleave opened 8 years ago

jvcleave commented 8 years ago

Might be a logic error but something like this

if(showStatsWindow)
        {
            if(ImGui::Begin("App Stats", &showStatsWindow))
            {
                ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
                ImGui::End();
            }
        }

would trigger an error here: https://github.com/jvcleave/ofxImGui/blob/master/libs/imgui/src/imgui.cpp#L2355

if the window bar was double-clicked quickly.

The below implementation doesn't seem to have the same issue

if(showStatsWindow)
        {
            if(!ImGui::Begin("App Stats", &showStatsWindow))
            {
               ImGui::End(); 
            }else
            {
                ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
                ImGui::End();
            }
        }

I tried this PR as well but it didn't make a difference https://github.com/jvcleave/ofxImGui/pull/33