Skip to content

Commit

Permalink
params.callbacks.RegisterTests called at first Frame
Browse files Browse the repository at this point in the history
(It cannot be called during setup, since the GIL is not available on the main thread after coroutine was created)
  • Loading branch information
pthom committed Oct 5, 2023
1 parent a1d7eb4 commit 5c28b44
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/hello_imgui/internal/backend_impls/abstract_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,6 @@ void AbstractRunner::Setup()
if (params.callbacks.PostInit)
params.callbacks.PostInit();

#ifdef HELLOIMGUI_WITH_TEST_ENGINE
if (params.useImGuiTestEngine && params.callbacks.RegisterTests)
params.callbacks.RegisterTests();
#endif

Impl_SetupPlatformRendererBindings();

//
Expand Down Expand Up @@ -464,6 +459,14 @@ void AbstractRunner::CreateFramesAndRender()
{
LayoutSettings_HandleChanges();

#ifdef HELLOIMGUI_WITH_TEST_ENGINE
if (mIdxFrame == 1)
{
if (params.useImGuiTestEngine && params.callbacks.RegisterTests)
params.callbacks.RegisterTests();
}
#endif

// Note about the application window initial placement and sizing
// i/ On the first frame (mIdxFrame==0), we create a window, and use the user provided size (if provided). The window is initially hidden.
// (this was done much sooner by mBackendWindowHelper)
Expand Down

0 comments on commit 5c28b44

Please sign in to comment.