Skip to content

Commit

Permalink
Added a boolean to prevent cataimgui::client::new_frame to be called …
Browse files Browse the repository at this point in the history
…twice in a row
  • Loading branch information
katemonster33 committed Feb 29, 2024
1 parent 0f6f3d5 commit 8c97a1b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ui_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

using ui_stack_t = std::vector<std::reference_wrapper<ui_adaptor>>;

#if !defined(__ANDROID__)
static bool imgui_frame_started = false;
#endif
static bool redraw_in_progress = false;
static bool showing_debug_message = false;
static bool restart_redrawing = false;
Expand Down Expand Up @@ -341,7 +344,11 @@ void ui_adaptor::redraw_invalidated( )
return;
}
#if !defined(__ANDROID__)
imclient->new_frame();
// This boolean is needed when a debug error is thrown inside redraw_invalidated
if( !imgui_frame_started ) {
imclient->new_frame();
}
imgui_frame_started = true;
#endif

restore_on_out_of_scope<bool> prev_redraw_in_progress( redraw_in_progress );
Expand Down Expand Up @@ -450,6 +457,7 @@ void ui_adaptor::redraw_invalidated( )

#if !defined(__ANDROID__)
imclient->end_frame();
imgui_frame_started = false;
#endif
}

Expand Down

0 comments on commit 8c97a1b

Please sign in to comment.