Repository navigation
status-icon: use a weak ref for the ListNames callback - #220
Open
climashscape wants to merge 1 commit into
Open
climashscape wants to merge 1 commit into
climashscape wants to merge 1 commit into
Conversation
look_for_status_applet() passes a bare XAppStatusIcon pointer. The owning SnItem can be removed while ListNames is in flight and drops its ref, finalizing the icon; on_list_names_completed() then uses freed memory (g_bus_own_name_on_connection with a stale connection). Pass a GWeakRef wrapper and bail out if the icon is gone.
This branch has not been deployed
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.
This is the master version of the 3.2-maintenance fix.
masterstill passes the bareXAppStatusIcon *inlook_for_status_applet()toon_list_names_completed(). The same use-after-free exists when the owningSnItemis removed while theListNamescall is in flight: the callback then dereferencesself->priv->interface_skeleton/self->priv->connectionon a freed icon (the 3.2 crash wason_list_names_completed → sync_skeleton → g_object_set, stacklibxapp+0x29bea/libxapp+0x2bfdf).The change is behaviorally identical to the 3.2-maintenance PR: use a
GWeakRefas the async user data; bail out if the icon is gone; free the error/result/ref on all paths.The patch applies to
masterat84df382and builds as xapp 3.4.0. The behavioral reproducer (SNI register + immediate connection close, private bus with a realXApp.StatusIconMonitor) was run against the patched master watcher:OK: watcher survived 300 registrations.If the branches are kept in sync by cherry-picking, this PR can be skipped in favor of the 3.2-maintenance one.
Related