cinder / Cinder

Cinder is a community-developed, free and open source library for professional-quality creative coding in C++.
http://libcinder.org
Other
5.27k stars 939 forks source link

Fixes DearImGui crash when the App issues more than one draw per update #2277

Closed simongeilfus closed 1 year ago

simongeilfus commented 2 years ago

As mentioned in https://github.com/cinder/Cinder/issues/2236 the app draw function is not guarantied to be called only once for each call to the update function. And as explained here it is illegal to call ImGui functions after ImGui::EndFrame()/ImGui::Render(). Failing to do so will trigger or an assert or crash the app. I believe the NewFrameGuard was slightly changed when adapted from Cinder-ImGui and is now missing a check before the app emits its draw calls.

This means that currently it is only safe to use ImGui inside the scope of the update function.

This can be easily reproduced on Windows by adding a ImGui::Text( "WillCrash" ) in the app draw method and dragging the window to the corner of the screen.

richardeakin commented 1 year ago

Thank you Simon and sorry to have missed this! 🙏