Repository navigation
window: release stray item references to a window before deleting it - #1442
Open
afonsojramos wants to merge 1 commit into
Open
afonsojramos wants to merge 1 commit into
afonsojramos wants to merge 1 commit into
Conversation
afonsojramos
force-pushed
the
window-release-references
branch
from
November 9, 2026 16:06
1181261 to
473febb
Compare
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
Quickshell segfaults when my only monitor disconnects (same stack, but not sure it is the same, as #1340:
derefWindow()fromsetParentItem()while aPanelWindowis destroyed).The cause was a window reference that Qt leaks. When an inline
ShaderEffectSourcegets itssourceItembefore it has a window (e.g. inside an asynchronousLoader), Qt refs the source item's window twice and releases it once. When the compositor closes the surface, Quickshell detaches the content and deletes the window, but that item keeps pointing at the deleted window, and destroying thePanelWindowlater crashes on it.This change releases any references that items in the content still hold on a window right before Quickshell deletes it.
Details and descisions
disownWindow(), because a window that is reused can still be legitimately referenced by things outside the content tree.windowChanged, and a handler could delete items, so the walk guards the item and its children withQPointer.PanelWindowwith this pattern): stock 0.3.2 crashes every run, and the patched build doesn't.Open concerns
QQuickShaderEffectSource::setSourceItem. I'll investigate this over the next couple of days.contentItem()is outside the walked tree and isn't covered, but that requires_backingWindow, and it crashes without this change too.Participation
I have this patched locally and have seen no further crash, so I'd like to see this through and can address review comments.