Repository navigation
status-icon: use a weak ref for the ListNames callback - #219
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.
Problem
Another use-after-free in the same tray-icon lifetime chain, this time in libxapp. Real coredump (2026-11-03 14:41:56):
Disassembly of the installed libxapp identifies
+0x29beaas theg_object_set()insync_skeleton()(it is followed byg_dbus_interface_skeleton_flush()), and+0x2bfdfas the call site inon_list_names_completed()(the function walks theListNamesresult, matchesorg.x.StatusIconMonitor, then callssync_skeleton()).look_for_status_applet()passes a bareXAppStatusIcon *to the asyncListNamescall. The icon is owned by anSnItem; when the client exits,sn_item_dispose()clearsitem->status_icon, the icon is finalized, and the callback then uses freed memory (self->priv->interface_skeleton,self->priv->connection).Fix
Use a
GWeakReffor the async user data.on_list_names_completed()only proceeds if the icon is still alive; it frees the error/result/wrapper on every path and returns if the icon is gone.Test
Same reproducer as the sn-item fix (register an SNI item and close the connection immediately, with a real monitor):
OK: watcher survived 1000 registrations(300 x4, including the combined build).Notes
3.2-maintenance.masterstill contains the same bare-pointer code; the same fix is submitted againstmasterin a separate PR.