Skip to content

service/pipewire: skip binding objects during registry teardown - #1460

Open
DanteCpp wants to merge 1 commit into
quickshell-mirror:masterfrom
DanteCpp:pipewire-teardown-bind
Open

DanteCpp wants to merge 1 commit into
quickshell-mirror:masterfrom
DanteCpp:pipewire-teardown-bind

Conversation

@DanteCpp

@DanteCpp DanteCpp commented Nov 8, 2026

Copy link
Copy Markdown

PwRegistry::reset() destroys the registry proxy before destroying its objects. Destruction can re-enter QML and ref an object that has not been destroyed yet, which then called pw_registry_bind() with a null registry.

Describe your changes

Fixes a segfault when the PipeWire connection drops (refs #1435).

When the connection hits a fatal error, PwRegistry::reset() destroys the registry proxy first and then tears down the nodes one by one. Destroying a node can re-enter QML. If a PwObjectTracker is bound to that node list, it refs the next node, which tries to bind against the registry that's already gone. That's pw_registry_bind(NULL, ...), and it crashes.

I hit this on 0.3.2 whenever my dock reconnected. The shell went down and didn't come back without a reboot.

Details and descisions

registryBind() returns false and skips the bind when the registry proxy is null. Skipping is fine because the node is destroyed later in the same reset(). It also returns false if pw_registry_bind itself fails, so bind() doesn't run hooks on a null object.

Repro: run a private PipeWire server with a few null sinks and a shell with PwObjectTracker { objects: Pipewire.nodes.values.slice(0, 1) }, then kill the server.

-> Unpatched master crashed 30 of 50 runs.
-> With the patch, 0 of 50 crashed, and it rebinds normally when the server comes back.

Participation

 _   _                           _
| | | | __ _ _ __  _ __  _   _  | |_ ___
| |_| |/ _` | '_ \| '_ \| | | | | __/ _ \
|  _  | (_| | |_) | |_) | |_| | | || (_) |
|_| |_|\__,_| .__/| .__/ \__, |  \__\___/
            |_|   |_|    |___/

            _     _                 _               _ _
  __ _  ___| |_  (_)_ ____   _____ | |_   _____  __| | |
 / _` |/ _ \ __| | | '_ \ \ / / _ \| \ \ / / _ \/ _` | |
| (_| |  __/ |_  | | | | \ V / (_) | |\ V /  __/ (_| |_|
 \__, |\___|\__| |_|_| |_|\_/ \___/|_| \_/ \___|\__,_(_)
 |___/

Cheers,
Dante

PwRegistry::reset() destroys the registry proxy before destroying its objects. Destruction can re-enter QML and ref an object that has not been destroyed yet, which then called pw_registry_bind() with a null registry.
@DanteCpp

DanteCpp commented Nov 8, 2026

Copy link
Copy Markdown
Author

The Arch job failed during configure on an HTTP 504 while fetching zstd for cpptrace. It's a network error unrelated to this change.

D.

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.

1 participant