fix(dispatcher): remove sender verification from SafeSlot

Keep receiver lifetime checks in dispatcher invalidation and relay delivery.
Deliver subscription context through metadata so waveform async updates
and log ingestion work without QObject.sender(). Reject stale scan updates.

Add regression coverage for queued delivery, subscription context isolation,
and waveform and logpanel updates through the dispatcher relay.
This commit is contained in:
2026-10-05 15:52:57 +02:00
committed by Jan Wyzula
parent bd0a231863
commit efc65bdf07
11 changed files with 162 additions and 85 deletions
+12 -27
View File
@@ -40,18 +40,12 @@ class TestSafeSlotClass(QObject):
def __init__(self, parent=None, signal_obj: TestSafeSlotEmitter | None = None):
super().__init__(parent)
assert signal_obj is not None, "Signal object must be provided"
signal_obj.test_signal.connect(self.method_without_sender_verification)
signal_obj.test_signal.connect(self.method_with_sender_verification)
self._method_without_verification_called = False
self._method_with_verification_called = False
signal_obj.test_signal.connect(self.receive)
self.calls = 0
@SafeSlot()
def method_without_sender_verification(self):
self._method_without_verification_called = True
@SafeSlot(verify_sender=True)
def method_with_sender_verification(self):
self._method_with_verification_called = True
def receive(self):
self.calls += 1
@pytest.fixture
@@ -174,25 +168,16 @@ def test_safe_property_setter_error(mock_exec, mock_log_error, qtbot, global_pop
@pytest.mark.timeout(100)
def test_safe_slot_emit(qtbot):
"""
Test that the signal is emitted correctly.
"""
@pytest.mark.parametrize("delivery", ["signal", "direct"])
def test_safe_slot_emit(qtbot, delivery):
"""SafeSlot executes both signal deliveries and ordinary Python calls."""
signal_obj = TestSafeSlotEmitter()
test_obj = TestSafeSlotClass(signal_obj=signal_obj)
signal_obj.test_signal.emit()
qtbot.waitUntil(lambda: test_obj._method_without_verification_called, timeout=1000)
qtbot.waitUntil(lambda: test_obj._method_with_verification_called, timeout=1000)
test_obj.deleteLater()
test_obj = TestSafeSlotClass(signal_obj=signal_obj)
test_obj.method_without_sender_verification()
test_obj.method_with_sender_verification()
assert test_obj._method_without_verification_called is True
assert test_obj._method_with_verification_called is False
if delivery == "signal":
signal_obj.test_signal.emit()
else:
test_obj.receive()
qtbot.waitUntil(lambda: test_obj.calls == 1, timeout=1000)
test_obj.deleteLater()
signal_obj.deleteLater()