AyatanaIndicators / libayatana-appindicator

Ayatana Application Indicators Shared Library
GNU Lesser General Public License v3.0
56 stars 13 forks source link

Fixes for segfault when running the Discord app. #51

Closed martinwhitaker closed 2 years ago

martinwhitaker commented 2 years ago

The Discord app. may run for anywhere between a couple of minutes and a couple of hours, but eventually crashes due to a segfault like this:

kernel: Discord[10481]: segfault at 259eda0e8000 ip 00007f99b6e4e365 sp 00007ffcbcf87a00 error 4 in libayatana-appindicator3.so.1.0.0[7f99b6e4a000+6000]

Searching the web for a solution, I found https://bugs.launchpad.net/ubuntu/+source/libappindicator/+bug/1867996. Applying both patches in that report to libayatana-appindicator fixes the bug for me. The first patch on its own was not sufficient. I haven't tried the second patch on its own.

fzwoch commented 2 years ago

Same here on Debian sid, libayatana-appindicator3-1, Version: 0.5.90-7.

#0  0x00007f0a5a23d6d5 in status_icon_changes (self=0x1d5be8df42f0 [AppIndicator], data=<optimized out>) at ./src/app-indicator.c:1623
#4  0x00007f0a6f01d6bf in <emit signal ??? on instance 0x1d5be8df42f0 [AppIndicator]>
    (instance=instance@entry=0x1d5be8df42f0, signal_id=<optimized out>, detail=detail@entry=0) at ../../../gobject/gsignal.c:3553
    #1  0x00007f0a6f00471f in g_closure_invoke
    (closure=0x1d5be92a9980, return_value=return_value@entry=0x0, n_param_values=1, param_values=param_values@entry=0x7ffc82783ed0, invocation_hint=invocation_hint@entry=0x7ffc82783e50) at ../../../gobject/gclosure.c:830
    #2  0x00007f0a6f016cf6 in signal_emit_unlocked_R
    (node=node@entry=0x1d5be93b9e40, detail=detail@entry=0, instance=instance@entry=0x1d5be8df42f0, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7ffc82783ed0) at ../../../gobject/gsignal.c:3743
    #3  0x00007f0a6f01d111 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7ffc82784050)
    at ../../../gobject/gsignal.c:3496
#5  0x00007f0a5a23c50d in app_indicator_set_icon_full (self=0x1d5be8df42f0 [AppIndicator], icon_name=0x1d5be93d0491 "discord1_3061", icon_desc=0x5586123043bb "icon")
    at ./src/app-indicator.c:2021
#6  0x00005586134baebd in  ()
#7  0x0000000000000000 in  ()

(gdb) info locals
path = 0x1d5be9f91000
n_elements = 3072
i = 139776
found = 0
icon = 0x1d5be8fa1350 [GtkStatusIcon]
priv = <optimized out>
icon_theme = 0x1d5be8e07e40 [GtkIconTheme]
theme_path = 0x1d5be945a270 "/tmp/.org.chromium.Chromium.NOlHyt"
icon_name = <optimized out>
fzwoch commented 2 years ago

I think this is the patch in question:

diff --git a/src/app-indicator.c b/src/app-indicator.c
index cb0086f..1183100 100644
--- a/src/app-indicator.c
+++ b/src/app-indicator.c
@@ -1619,7 +1619,7 @@ status_icon_changes (AppIndicator * self, gpointer data)
                gint n_elements, i;
                gboolean found=FALSE;
                gtk_icon_theme_get_search_path(icon_theme, &path, &n_elements);
-               for (i=0; i< n_elements || path[i] == NULL; i++) {
+               for (i=0; i< n_elements; i++) {
                        if(g_strcmp0(path[i], theme_path) == 0) {
                                found=TRUE;
                                break;

This has been discussed on the Ubuntu tracker here: https://bugs.launchpad.net/ubuntu/+source/libappindicator/+bug/1867996

hand has been patched there since March 2020.

martinwhitaker commented 2 years ago

@fzwoch, yes that is the second patch referred to in my initial comment, and the same Ubuntu tracker ticket.