Skip to content

SafeConnect double execution, stale connections, and SafeSlot override leakage#1244

Open
wyzula-jan wants to merge 1 commit into
mainfrom
fix/qt-safety
Open

SafeConnect double execution, stale connections, and SafeSlot override leakage#1244
wyzula-jan wants to merge 1 commit into
mainfrom
fix/qt-safety

Conversation

@wyzula-jan

Copy link
Copy Markdown
Contributor

Description

Fix issues with SafeConnect, previously any SafeConnect slot would be executed twice and connections from the deleted widget would be still connected on Qt level.

Copilot AI review requested due to automatic review settings July 15, 2026 14:46
@wyzula-jan wyzula-jan self-assigned this Jul 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes lifecycle and call-semantics issues in the SafeConnect/SafeSlot utilities to prevent double slot execution, avoid accumulating stale Qt connections, and ensure per-call overrides don’t mutate decorator defaults.

Changes:

  • Reworked SafeConnect to invoke the target slot exactly once per signal emission (with payload), and to self-disconnect when the receiver/slot becomes stale.
  • Updated SafeSlot to apply _override_slot_params on a per-call basis via a merged copy, preventing persistent mutation of decorator defaults.
  • Added regression tests covering the above behaviors (single execution, stale connection cleanup, override leakage).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/unit_tests/test_error_utils.py Adds regression tests for SafeConnect single-execution + stale-disconnect behavior, and SafeSlot per-call override behavior.
bec_widgets/utils/error_popups.py Fixes SafeConnect wrapper semantics and adds self-disconnect on stale refs; fixes SafeSlot override leakage by using per-call merged params.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@wyzula-jan
wyzula-jan requested a review from a team July 15, 2026 14:55
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
bec_widgets/utils/error_popups.py 87.50% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark comparison

Threshold: 20% (lower is better).
Result: 0 regression(s), 0 improvement(s) beyond threshold.

No benchmark regression exceeded the configured threshold.

No benchmark improvement exceeded the configured threshold.

All benchmark results
Benchmark Baseline Current Change Status
BEC IPython client with companion app 2.20399 s 2.01424 s -8.61% ok
BEC IPython client without companion app 2.18623 s 2.0226 s -7.48% ok
Import bec_widgets 0.0131978 s 0.0138056 s +4.61% ok
tests/unit_tests/benchmarks/test_dock_area_benchmark.py::test_add_waveform_to_dock_area 0.158608 s 0.145489 s -8.27% ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants