[Xfce4-commits] r25711 - xfce4-panel/trunk/plugins/launcher

Jasper Huijsmans jasper at xfce.org
Sun May 13 20:59:34 CEST 2007


Author: jasper
Date: 2007-05-13 18:59:34 +0000 (Sun, 13 May 2007)
New Revision: 25711

Modified:
   xfce4-panel/trunk/plugins/launcher/launcher-dialog.c
Log:
Fix possible crash when choosing cancel in properties dialog for newly created items (bug #3159).

Modified: xfce4-panel/trunk/plugins/launcher/launcher-dialog.c
===================================================================
--- xfce4-panel/trunk/plugins/launcher/launcher-dialog.c	2007-05-13 08:40:07 UTC (rev 25710)
+++ xfce4-panel/trunk/plugins/launcher/launcher-dialog.c	2007-05-13 18:59:34 UTC (rev 25711)
@@ -1442,6 +1442,13 @@
         /* read last saved settings */
         launcher_read (ld->launcher);
 
+        /* if this is a newly created item, there is no saved data yet */
+        if (G_UNLIKELY (g_list_length (ld->launcher->entries) == 0))
+        {
+              ld->launcher->entries = g_list_append (ld->launcher->entries, 
+                                                     launcher_new_entry ());
+        }
+
         /* update the panel again */
         launcher_dialog_update_panel (ld);
     }
@@ -1476,7 +1483,12 @@
     ld->launcher = launcher;
 
     /* get first entry */
-    ld->entry = g_list_first (launcher->entries)->data;
+    if (G_UNLIKELY (g_list_length (launcher->entries) == 0)) 
+    {
+        launcher->entries = g_list_append (launcher->entries, 
+                                           launcher_new_entry ());
+    }
+    ld->entry = launcher->entries->data;
 
     /* lock right-click plugin menu */
     xfce_panel_plugin_block_menu (launcher->plugin);



More information about the Xfce4-commits mailing list