fix: defer hou.hscript via QTimer.singleShot(0) — avoids re-entrancy in signal handler

This commit is contained in:
Hermes
2026-07-12 14:11:24 +00:00
parent 5b410dca9e
commit 37cc1f0736
+5
View File
@@ -129,6 +129,11 @@ class HermesBridgeWindow(QtWidgets.QWidget):
f"on {self.hostname} (port {self.port}).")
def _toggle(self):
# Defer to next event loop cycle — avoids re-entrancy
# issues with hou.hscript in signal handler context
QtCore.QTimer.singleShot(0, self._execute_toggle)
def _execute_toggle(self):
try:
if bridge_is_open(self.port):
hou.hscript(f"closeport {self.port}")