@@ -244,6 +244,7 @@ void init(std::string backend) {
244244 // Create an initial context based context. Note that calling show() never actually uses this context, because it
245245 // pushes a new one each time. But using frameTick() may use this context.
246246 contextStack.push_back (ContextEntry{ImGui::GetCurrentContext (), ImPlot::GetCurrentContext (), nullptr , true });
247+ internal::contextStackSize++;
247248
248249 view::invalidateView ();
249250
@@ -293,6 +294,7 @@ void pushContext(std::function<void()> callbackFunction, bool drawDefaultUI) {
293294 ImGuizmo::PushContext ();
294295
295296 contextStack.push_back (ContextEntry{newContext, newPlotContext, callbackFunction, drawDefaultUI});
297+ internal::contextStackSize++;
296298
297299 if (contextStack.size () > 50 ) {
298300 // Catch bugs with nested show()
@@ -340,6 +342,7 @@ void popContext() {
340342 return ;
341343 }
342344 contextStack.pop_back ();
345+ internal::contextStackSize--;
343346}
344347
345348ImGuiContext* getCurrentContext () { return contextStack.empty () ? nullptr : contextStack.back ().context ; }
@@ -743,7 +746,7 @@ void buildPolyscopeGui() {
743746 if (ImGui::BeginPopup (" ScreenshotOptionsPopup" )) {
744747
745748 ImGui::Checkbox (" with transparency" , &options::screenshotTransparency);
746- ImGui::Checkbox (" with UI" , &options::screenshotWithImGuiUI);
749+ // ImGui::Checkbox("with UI", &options::screenshotWithImGuiUI); // temporarily disabled while broken
747750
748751 if (ImGui::BeginMenu (" file format" )) {
749752 if (ImGui::MenuItem (" .png" , NULL , options::screenshotExtension == " .png" )) options::screenshotExtension = " .png" ;
@@ -1201,6 +1204,7 @@ void shutdown(bool allowMidFrameShutdown) {
12011204 render::engine->shutdown ();
12021205 delete render::engine;
12031206 contextStack.clear ();
1207+ internal::contextStackSize = 0 ;
12041208 render::engine = nullptr ;
12051209 state::backend = " " ;
12061210 state::initialized = false ;
0 commit comments