Skip to content

Commit

Permalink
Misc: During shutdown, check that io.BackendPlatformUserData and io.B…
Browse files Browse the repository at this point in the history
…ackendRendererUserData are NULL. (#7175)
  • Loading branch information
ocornut committed Jan 3, 2024
1 parent 0ea9913 commit 33d18c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Other changes:
to allow passing through multiple widgets easily. (#3092, #5759, #787)
- Drags, Sliders, Inputs: removed all attempts to filter non-numerical characters during text
editing. Invalid inputs not applied to value, visibly reverted after validation. (#6810, #7096)
- Drags, Sliders, Inputs: removal of filter means that "nan" and "inf" values may be input. (#7096)
- DragScalarN, SliderScalarN, InputScalarN, PushMultiItemsWidths: improve multi-components
width computation to better distribute the error. (#7120, #7121) [@Nahor]
- ColorEdit4: Layout tweaks for very small sizes. (#7120, #7121)
Expand All @@ -90,6 +91,8 @@ Other changes:
like most printf implementations. (#7016, #3466, #6846) [@codefrog2002]
- Misc: Renamed some defines in imstb_textedit.h to avoid conflicts when using unity/jumbo builds
on a codebase where another copy of the library is used.
- Misc: During shutdown, check that io.BackendPlatformUserData and io.BackendRendererUserData are NULL
in order to catch cases where backend was not shut down. (#7175)
- Backends: GLFW, Emscripten: Added ImGui_ImplGlfw_InstallEmscriptenCanvasResizeCallback() to
register canvas selector and auto-resize GLFW window. (#6751) [@Traveller23, @ypujante]
- Backends: GLFW: Fixed Windows specific hooks to use Unicode version of WndProc even when
Expand Down
5 changes: 4 additions & 1 deletion imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3604,8 +3604,11 @@ void ImGui::Initialize()
// This function is merely here to free heap allocations.
void ImGui::Shutdown()
{
// The fonts atlas can be used prior to calling NewFrame(), so we clear it even if g.Initialized is FALSE (which would happen if we never called NewFrame)
ImGuiContext& g = *GImGui;
IM_ASSERT_USER_ERROR(g.IO.BackendPlatformUserData == NULL, "Forgot to shutdown Platform backend?");
IM_ASSERT_USER_ERROR(g.IO.BackendRendererUserData == NULL, "Forgot to shutdown Renderer backend?");

// The fonts atlas can be used prior to calling NewFrame(), so we clear it even if g.Initialized is FALSE (which would happen if we never called NewFrame)
if (g.IO.Fonts && g.FontAtlasOwnedByContext)
{
g.IO.Fonts->Locked = false;
Expand Down

0 comments on commit 33d18c5

Please sign in to comment.