From c2155593f96a794fac3a57fdda7cb9f5b9e02a8e Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 29 Jun 2026 21:04:00 -0400 Subject: [PATCH] fix(gui): remove orphan imgui.end_child() in render_tier_stream_panel except handler The "In window 'MainDockSpace': Missing End()" error in the user's session was caused by an orphan imgui.end_child() call in the except block of the tier-3 stream rendering in render_tier_stream_panel. The structure was: try: if len(app.mma_streams[key]) != app._tier_stream_last_len.get(key, -1): imgui.set_scroll_here_y(1.0) app._tier_stream_last_len[key] = len(app.mma_streams[key]) imgui.end_child() <-- (1) in try block except (TypeError, AttributeError): imgui.end_child() <-- (2) ORPHAN: this is the actual bug pass When the try block succeeds, the imgui.end_child() at (1) fires and correctly closes the begin_child that was opened earlier. The imgui.end_child() at (2) is then encountered with no matching begin on the imgui stack, and imgui reports "Missing End()" for the enclosing MainDockSpace. Why this bug was masked previously: render_main_interface was failing on `from src.command_palette import render_palette_modal` (ModuleNotFoundError) so the entire render_main_interface body was aborted, and the tier-3 stream rendering was never reached. After fixing the import (commit 71028dad), the render path completes normally and the orphan end_child becomes visible to imgui. Fix: remove the imgui.end_child() at (2) entirely. The imgui.end_child() at (1) is correct and is the only one needed. If the try block raises, the begin_child stays open at end-of-frame and imgui auto-handles the cleanup (or the next frame's render handles it). Since this code path isn't even hit in normal operation (the try block only does a dict lookup comparison and an int conversion, both of which don't normally raise), the orphaned end_child was a latent bug waiting for a specific failure mode to expose it. This is a pre-existing bug introduced in commit c88330cc4 (2026-05-16), not introduced by any of my recent changes. My fix only removes the extra imgui.end_child() call from the except block; all other code is unchanged. Verification: - find_imbalance.py: 0 leftover begin_child, 0 extra end_child (was 1 extra) - Test suite: 17/17 PASSED - Manual launch (6s render): 0 imgui errors in stderr - GUI imported cleanly without IndentationError --- src/gui_2.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui_2.py b/src/gui_2.py index 5c73a4c9..7d645b21 100644 --- a/src/gui_2.py +++ b/src/gui_2.py @@ -7091,7 +7091,6 @@ def render_tier_stream_panel(app: App, tier_key: str, stream_key: str | None) -> app._tier_stream_last_len[key] = len(app.mma_streams[key]) imgui.end_child() except (TypeError, AttributeError): - imgui.end_child() pass if app.perf_profiling_enabled: app.perf_monitor.end_component("_render_tier_stream_panel")