From 247658990502a3e64a3301fb3fc6bf2e4e78ae85 Mon Sep 17 00:00:00 2001 From: wyzula-jan Date: Mon, 26 Jan 2026 11:31:35 +0100 Subject: [PATCH] fix(bec_connector): use RPC register to fetch all connections --- bec_widgets/utils/bec_connector.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/bec_widgets/utils/bec_connector.py b/bec_widgets/utils/bec_connector.py index 91d53e33..8d5ee607 100644 --- a/bec_widgets/utils/bec_connector.py +++ b/bec_widgets/utils/bec_connector.py @@ -238,15 +238,10 @@ class BECConnector: siblings = parent_bec.findChildren(BECConnector) else: # No parent => treat all top-level BECConnectors as siblings - # 1) Gather all BECConnectors from QApplication - all_widgets = QApplication.allWidgets() - all_bec = [w for w in all_widgets if isinstance(w, BECConnector)] - # 2) "Top-level" means closest BECConnector parent is None - top_level_bec = [ - w for w in all_bec if WidgetHierarchy._get_becwidget_ancestor(w) is None - ] - # 3) We are among these top-level siblings - siblings = top_level_bec + # Use RPCRegister to avoid QApplication.allWidgets() during event processing. + connections = self.rpc_register.list_all_connections().values() + all_bec = [w for w in connections if isinstance(w, BECConnector)] + siblings = [w for w in all_bec if WidgetHierarchy._get_becwidget_ancestor(w) is None] # Collect used names among siblings used_names = {sib.objectName() for sib in siblings if sib is not self}