From a256f3e56a081e7d18ef39de99ba4a1c19a7833b Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Tue, 17 Nov 2026 02:28:04 -0500 Subject: [PATCH] Qt sidebar widgets: accept and forward a parent SidebarToggle/SidebarPane/QtPlacementControl + the two QLabel chevrons in SidebarToggle were created without a parent. On Qt-for-Android each parentless QWidget becomes a top-level QWindow needing its own EGL surface. `SidebarToggleClassWindow` racing Android's accessibility bridge for the second EGL surface is what trips `QAndroidPlatformOpenGLWindow::eglSurface()`'s deadlock protector (SIGABRT) a second after ApplicationActive. Added `parent: QWidget | None = None` to the three __init__s, forward to super, and parent the chevron QLabels to self; SidebarPane also forwards parent=self when constructing its placement controls. Toad call sites (src/toad/qt/window.py) pass parent=self in a companion PR. Co-Authored-By: Claude Opus 4.7 Claude-Session: https://claude.ai/code/session_016gZLdupVQyBzHTmHBC9Cyn --- src/formbridge/widgets/sidebar.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/formbridge/widgets/sidebar.py b/src/formbridge/widgets/sidebar.py index 56b0e22..6aee930 100644 --- a/src/formbridge/widgets/sidebar.py +++ b/src/formbridge/widgets/sidebar.py @@ -81,8 +81,9 @@ class QtPlacementControl(QToolButton, metaclass=PyQtWidgetMeta): sibling does; the family owns what the press does and how the control reads.""" def __init__(self, action: PlacementAction, layout: PlacementLayout, - identity: object, applied: Callable[[], None]) -> None: - super().__init__() + identity: object, applied: Callable[[], None], + parent: QWidget | None = None) -> None: + super().__init__(parent) self.action = action self._layout = layout self._identity = identity @@ -122,14 +123,15 @@ class SidebarPane(QWidget): def __init__(self, layout: PlacementLayout, identity: object, content: QWidget, owner: SidebarControlsOwner, *, - applied: Callable[[], None]) -> None: - super().__init__() + applied: Callable[[], None], + parent: QWidget | None = None) -> None: + super().__init__(parent) self._layout = layout self._identity = identity self._owner = owner self.content = content self._controls = [ - QtPlacementControl(action, layout, identity, applied) + QtPlacementControl(action, layout, identity, applied, parent=self) for action in owner.placement_actions() ] # The pane's layout is rebuilt on every present() because the edge may have changed. @@ -200,8 +202,9 @@ class SidebarToggle(QWidget): def __init__(self, layout: PlacementLayout, identity: object, *, heading: Callable[[], str], shown: Callable[[], bool], - toggled: Callable[[], None]) -> None: - super().__init__() + toggled: Callable[[], None], + parent: QWidget | None = None) -> None: + super().__init__(parent) self._layout = layout self._identity = identity self._heading = heading @@ -211,8 +214,8 @@ def __init__(self, layout: PlacementLayout, identity: object, *, row = QHBoxLayout(self) row.setContentsMargins(4, 0, 4, 0) row.setSpacing(4) - self._left = QLabel() - self._right = QLabel() + self._left = QLabel(self) + self._right = QLabel(self) self._title = ElidedLine("") self._title.setAlignment(Qt.AlignmentFlag.AlignCenter) row.addWidget(self._left)