Repository navigation
service/pipewire: guard against null registry proxy during object teardown - #1470
Open
devpryan7792 wants to merge 1 commit into
Open
devpryan7792 wants to merge 1 commit into
devpryan7792 wants to merge 1 commit into
Conversation
…rdown When PipeWire experiences a fatal error or transport disconnect (e.g. Bluetooth device disconnection), PwConnection initiates teardown via PwRegistry::reset(). In that path, the registry proxy was previously destroyed and nulled prior to safeDestroy() running on child objects. Destruction of nodes and interfaces triggers QObject notifications and QML property bindings which can re-evaluate and call PwObjectTracker::setObjects(), referencing nodes and invoking ref(). If an unbound node enters bind(), PwBindableObject::registryBind() called pw_registry_bind() with a null registry pointer, causing a SIGSEGV. Fix this by: 1. Reordering PwRegistry::reset() so child objects (metadata, links, nodes, devices) are torn down before the parent registry proxy is destroyed. 2. Guarding PwBindableObject::registryBind() against null registry, null registry proxy, or id == 0. 3. Guarding PwBindable::bind() so bindHooks() are not executed if registryBind() was unable to allocate a proxy. 4. Setting id = 0 in PwBindableObject::safeDestroy() prior to emitting the destroying() signal. Closes quickshell-mirror#1468 Signed-off-by: Pradyumn jha <devpryan7792@users.noreply.github.com>
KeganHollern
approved these changes
Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
Prevents a SIGSEGV during PipeWire teardown when Bluetooth audio disconnects or when a fatal PipeWire error triggers
PwRegistry::reset().Specifically:
metadata,links,nodes,devices) withsafeDestroy()before destroying the registry proxythis->object.PwBindableObject::registryBind()against a null registry, null registry proxy, orid == 0.PwBindable::bind(), skips executingbindHooks()ifregistryBind()was unable to obtain a valid proxy.this->id = 0inPwBindableObject::safeDestroy()before emittingdestroying(this).Closes #1468.
Details and descisions
When a PipeWire error occurs (e.g. error on object 6 with code -14 upon Bluetooth device disconnect),
PwConnection::onFatalError()callsPwRegistry::reset().Previously,
reset()immediately destroyedthis->objectand set it tonullptr. WhensafeDestroy()then ran on remaining nodes and interfaces, emittingdestroying(this)and Qt'sdelete thistriggered property updates and QML bindings (such asPwObjectTracker::setObjects()). That calledpwObject->ref()on incoming nodes. When an unbound node enteredbind(),PwBindableObject::registryBind()invokedpw_registry_bind(this->registry->object, ...)with a null registry pointer, causing a crash atldr x0, [x6, #16].By tearing down child proxies before destroying the parent registry proxy, guarding against null in
registryBind(), and ensuringid == 0during destruction, re-entrant binds during teardown are safely aborted.Open concerns
None. Build and CTest suite verified locally.
Participation
Happy to address review feedback and maintain/contribute to PipeWire and Wayland service integrations in Quickshell.