Skip to content

Commit

Permalink
TearDown: do not run user callbacks if exiting on unhandled exception
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Jun 9, 2024
1 parent 617bbc2 commit 8d3459c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/hello_imgui/internal/backend_impls/abstract_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1433,8 +1433,9 @@ void AbstractRunner::TearDown(bool gotException)

HelloImGui::internal::Free_ImageFromAssetMap();

if (params.callbacks.BeforeExit)
params.callbacks.BeforeExit();
if (!gotException && params.callbacks.BeforeExit)
params.callbacks.BeforeExit();

#ifdef HELLOIMGUI_WITH_TEST_ENGINE
if (params.useImGuiTestEngine)
TestEngineCallbacks::TearDown_ImGuiContextAlive();
Expand All @@ -1444,7 +1445,7 @@ void AbstractRunner::TearDown(bool gotException)
Impl_Cleanup();


if (params.callbacks.BeforeExit_PostCleanup)
if (!gotException && params.callbacks.BeforeExit_PostCleanup)
params.callbacks.BeforeExit_PostCleanup();
#ifdef HELLOIMGUI_WITH_TEST_ENGINE
if (params.useImGuiTestEngine)
Expand Down

0 comments on commit 8d3459c

Please sign in to comment.