canonical / canonical/multipass

Slots should not throw

Open
#575 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
9.2k
Forks
828
Avg merge
3d 2h
Merged PRs (30d)
43

Description

I just found out that *Throwing an exception from a slot invoked by Qt's signal-slot connection mechanism is considered undefined behaviour, unless it is handled within the slot* ([here](https://doc.qt.io/qt-5/exceptionsafety.html#signals-and-slots)).

We should probably declare all of [these](https://github.com/CanonicalLtd/multipass/blob/4bd6a5885e2ed851cb8971b45dcd686fb4bca967/src/daemon/daemon.h#L77) noexcept and perhaps add a `catch(...)` (only std::exception is caught ATM).

Other *callables* used as slots could also do with a review and be similarly safe-guarded.

Contributor guide

Open the contributing guide

Research direction

Start with the slots listed in src/daemon/daemon.h around line 77 and inspect the existing exception handling, including the current std::exception catch. Review the other callable slots mentioned in the issue; done means exceptions from these signal-slot paths are handled safely rather than escaping the slot.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.