! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
xfce4-appfinder crashes on startup
Status:
RESOLVED: FIXED
Severity:
critical
Product:
Xfce4-appfinder
Component:
General

Comments

Description Shayne O'Connor 2006-06-01 03:55:49 CEST
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.4) Gecko/20060527 Firefox/1.5 Flock/0.7.0.11.1.0
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.4) Gecko/20060527 Firefox/1.5 Flock/0.7.0.11.1.0

Ever since an SVN update a few weeks ago, I can no longer start xfce4-appfinder ... if i start from a terminal, it just segfaults, but if i run it through gdb, it gives a backtrace.

Reproducible: Always
Comment 1 Shayne O'Connor 2006-06-01 03:57:01 CEST
Created attachment 585 
Backtrace for Xfce4-Appfinder
Comment 2 Gergan Penkov 2006-10-09 11:36:48 CEST
Well it seems the same bug, which I experience.
Now there are two place in the source, where I simply fail to grok the logic and look more like typos:
in function build_desktop_paths it goes at the end like this:
    for (n = 0; n < napplnk; ++i, ++n)
    {
        desktop_entries_paths[i] = applnk[n];
    }
    g_free (applnk);
    
    desktop_path_number = n;
so here n is the number of entries in applink and not the end of the desktop_entries_paths (so it is in some random place in it). Just changing it to i makes the segfaults disappear for me.
But this is only the half of the story, this value is used in createDesktopCache, also at the end of it - n is desktop_path_number-1:
                else if (g_file_test(fullpath, G_FILE_TEST_IS_DIR))
                {
                    desktop_entries_paths[n] = fullpath;
                    desktop_entries_paths[n] = NULL;
                }
            }
            g_dir_close(dir);
        }
        i++;
which I really could not grasp, since the double assignment is useless, even if it is typo aka n-1, n or sth like this, it does not make sense to me, as it should add dirs to be scanned recursively and desktop_entries_paths is fixed size array - so changing only the last entry in order to add new dir to be scanned, would not do in certain situations - /usr/share/applications having >1 subdirectories, as simply the last found dir will overwrite this entry in the array.
I have made a patch to use GPtrArray instead of fixed array for desktop_entries_paths and it seems to work fine here (also adding desktop entries from /usr/share/applications/screensavers and such), but I have never written anything glib/gtk related, so it should be taken with grasp of salt :)
Comment 3 Gergan Penkov 2006-10-09 11:40:25 CEST
Created attachment 822 
g_ptr_array.patch

patch to use GPtrArray instead of fixed array
Comment 4 Jani Monoses 2006-10-23 12:01:51 CEST
I can confirm this still exists in svn trunk, and this pacth solves it
Comment 5 Jasper Huijsmans editbugs 2006-12-09 11:40:35 CET
Gergan, thank you very much for that patch. It makes a lot of sense to me, so I have committed it to SVN with revision 24071.

Bug #1882

Reported by:
Shayne O'Connor
Reported on: 2006-06-01
Last modified on: 2009-07-14

People

Assignee:
Jannis Pohlmann
CC List:
1 user

Version

Attachments

Backtrace for Xfce4-Appfinder (5.76 KB, text/plain)
2006-06-01 03:57 CEST , Shayne O'Connor
no flags
g_ptr_array.patch (4.98 KB, patch)
2006-10-09 11:40 CEST , Gergan Penkov
no flags

Additional information