segfault if .desktop file is not installed

Bug #1058386 reported by Jim Nelson on 2012-09-28
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Messaging Menu
Fix Released
High
Lars Karlitski
indicator-messages (Ubuntu)
High
Unassigned

Bug Description

If the application's .desktop file isn't install, it will crash after creating a MessagingMenu.App object. This simple Vala program demonstrates this:

void main(string[] args) {
    Gtk.init(ref args);

    MessagingMenu.App app = new MessagingMenu.App("booga.desktop");
    app.register();

    Gtk.main();
}

To compile:

$ valac --pkg=gtk+-3.0 --pkg=MessagingMenu-1.0 test2.vala

(GTK may not be strictly required to repro this bug.)

At a minimum, I wouldn't expect the application to crash in this situation.

What would be *better* is if the caller could supply a path to a .desktop file rather than MessagingMenu expect to find it in /usr/share/applications. It could be provided with a different MessagingMenu.App constructor, i.e. MessagingMenu.App.for_desktop_file(). We like to be able to build, run, and test our apps from the build directory.

Related branches

Jim Nelson (yorba-jim) wrote :
Lars Karlitski (larsu) on 2012-10-01
Changed in indicator-messages:
milestone: none → 12.10.4
assignee: nobody → Lars Uebernickel (larsu)
importance: Undecided → High
status: New → In Progress
Lars Karlitski (larsu) wrote :

Hi Jim, thanks for reporting the crash. The attached branch fixes the issue.

I disagree on allowing to pass desktop filenames. The messaging menu uses g_desktop_app_info_new, which follows the XDG spec for desktop files. This is useful for distributors and users to override desktop files.

Passing paths directly can also be misused easily: only correctly installed applications should ever be shown in the messaging menu, so that users can find the same application in the dash.

> We like to be able to build, run, and test our apps from the build directory.

Easiest would be to copy the desktop file into ~/.local/share/applications/ temporarily. Alternatively, you could restart indicator-messages-service with XDG_DATA_DIRS set to the source path of your application.

Changed in indicator-messages (Ubuntu):
status: New → Triaged
Lars Karlitski (larsu) on 2012-10-02
Changed in indicator-messages:
status: In Progress → Fix Committed
Lars Karlitski (larsu) on 2012-10-02
Changed in indicator-messages:
status: Fix Committed → Fix Released
Changed in indicator-messages (Ubuntu):
importance: Undecided → High
status: Triaged → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package indicator-messages - 12.10.4-0ubuntu1

---------------
indicator-messages (12.10.4-0ubuntu1) quantal; urgency=low

  * New upstream release:
    - don't segfault if .desktop file is not installed (lp: #1058386)
    - Use fallback icon names (without status emblems).
      (lp: #1056595)
 -- Sebastien Bacher <email address hidden> Tue, 02 Oct 2012 23:20:19 +0200

Changed in indicator-messages (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments