Skip to content

Commit

Permalink
Merge pull request #72074 from katemonster33/imgui_draw_debug_error_c…
Browse files Browse the repository at this point in the history
…rash

Fixing an imgui-related crash related to debug errors
  • Loading branch information
Maleclypse authored Mar 1, 2024
2 parents 0aff7d5 + 8c97a1b commit c364b31
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 c364b31

Please sign in to comment.