Skip to content

Fix SIGSEGV crash in _getActivationToken when appInfo is null#607

Open
doziedotdev wants to merge 2 commits into
ubuntu:masterfrom
doziedotdev:fix/null-appinfo-crash-in-getActivationToken
Open

Fix SIGSEGV crash in _getActivationToken when appInfo is null#607
doziedotdev wants to merge 2 commits into
ubuntu:masterfrom
doziedotdev:fix/null-appinfo-crash-in-getActivationToken

Conversation

@doziedotdev

Copy link
Copy Markdown

Summary

Fixes a crash (SIGSEGV) that occurs when clicking on certain tray icons. The crash happens in _getActivationToken() when:

  1. this.id is null, causing Gio.AppInfo.create_from_commandline() to fail
  2. The resulting null fakeAppInfo is passed to get_startup_notify_id(), which crashes in g_app_info_get_name() -> strlen(NULL)

Changes

  • Commit 1: Add fallback chain for appName (this.id || this._commandLine || 'unknown') to ensure it's never null
  • Commit 2: Add null guard for fakeAppInfo to gracefully handle cases where create_from_commandline() fails

Crash Details

gnome-shell: g_app_info_get_name: assertion 'G_IS_APP_INFO (appinfo)' failed
gnome-shell: segfault at 0 ip 00007fda22157bdd ... in libc.so.6

Stack Trace

#0  __strlen_avx2 (libc.so.6)
#1  sn_internal_strdup (libstartup-notification-1.so.0)
#2  sn_launcher_context_set_name (libstartup-notification-1.so.0)
#3  meta_launch_context_get_startup_notify_id (libmutter-16.so.0)
...
#37 st_button_button_release (libst-16.so)

Reproduction

  1. Have a tray application that registers without a valid Id property (observed with some Electron apps)
  2. Click on the tray icon
  3. GNOME Shell crashes with SIGSEGV

Testing

  • Verified the fix prevents the crash by ensuring appName and fakeAppInfo are never null
  • Callers of _getActivationToken() (e.g., provideActivationToken()) already handle null activationToken gracefully

Environment

  • GNOME Shell 48.6
  • Mutter 48.6
  • Fedora 42
  • Extension version 60

When this.id is null, Gio.AppInfo.create_from_commandline() would
receive null as the application name parameter, which could cause
issues downstream when the AppInfo is used.

Add a fallback chain (this.id || this._commandLine || 'unknown') to
ensure appName is never null.
Gio.AppInfo.create_from_commandline() can return null if it fails to
create the AppInfo object. Without this check, calling
get_startup_notify_id() with a null fakeAppInfo causes a SIGSEGV
crash in g_app_info_get_name() -> strlen(NULL).

This crash was observed in the wild when clicking tray icons from
applications that register with StatusNotifierWatcher without a
valid Id property.

Stack trace from crash:
  #0 __strlen_avx2 (libc.so.6)
  ubuntu#1 sn_internal_strdup (libstartup-notification-1.so.0)
  ubuntu#2 sn_launcher_context_set_name (libstartup-notification-1.so.0)
  ubuntu#3 meta_launch_context_get_startup_notify_id (libmutter)

Return [launchContext, null] when fakeAppInfo creation fails,
allowing callers to handle the missing activation token gracefully.
@3v1n0

3v1n0 commented Feb 12, 2026

Copy link
Copy Markdown
Collaborator

Thanks for your MR, however this was handled upstream via https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4705

Let me know if this is still affecting old gnome shell versions, in case it does, I'm fine adding this check, but only for old versions, would that work for you?

@3v1n0

3v1n0 commented Feb 26, 2026

Copy link
Copy Markdown
Collaborator

Happy to scope this to older GNOME versions if you'd prefer — for example guarding with a version check so it's only applied for GNOME < 49. Let me know what approach works best and I'll update the PR accordingly.

This is likely the best approach

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.

2 participants