nautilus r13890 - in trunk: . src/file-manager



Author: alexl
Date: Thu Mar  6 13:49:12 2008
New Revision: 13890
URL: http://svn.gnome.org/viewvc/nautilus?rev=13890&view=rev

Log:
2008-03-06  Alexander Larsson  <alexl redhat com>

	* src/file-manager/fm-directory-view.c (add_template_to_templates_menus): 
	Avoid crashing if no pixbuf for menu icon. (#513719)



Modified:
   trunk/ChangeLog
   trunk/src/file-manager/fm-directory-view.c

Modified: trunk/src/file-manager/fm-directory-view.c
==============================================================================
--- trunk/src/file-manager/fm-directory-view.c	(original)
+++ trunk/src/file-manager/fm-directory-view.c	Thu Mar  6 13:49:12 2008
@@ -4890,7 +4890,6 @@
 	tip = g_strdup_printf (_("Run \"%s\" on any selected items"), name);
 
 	launch_parameters = script_launch_parameters_new (file, directory_view);
-	pixbuf = get_menu_icon_for_file (file);
 
 	action_name = escape_action_name (uri, "script_");
 	escaped_label = eel_str_double_underscores (name);
@@ -4900,9 +4899,12 @@
 				 tip,
 				 NULL);
 	
-	g_object_set_data_full (G_OBJECT (action), "menu-icon",
-				g_object_ref (pixbuf),
-				g_object_unref);
+	pixbuf = get_menu_icon_for_file (file);
+	if (pixbuf != NULL) {
+		g_object_set_data_full (G_OBJECT (action), "menu-icon",
+					pixbuf,
+					g_object_unref);
+	}
 
 	g_signal_connect_data (action, "activate",
 			       G_CALLBACK (run_script_callback),
@@ -4937,8 +4939,6 @@
 			       GTK_UI_MANAGER_MENUITEM,
 			       FALSE);
 
-
-	g_object_unref (pixbuf);
 	g_free (name);
 	g_free (uri);
 	g_free (tip);
@@ -4967,7 +4967,9 @@
 	add_submenu (ui_manager, action_group, merge_id, menu_path, uri, name, pixbuf, TRUE);
 	add_submenu (ui_manager, action_group, merge_id, popup_path, uri, name, pixbuf, FALSE);
 	add_submenu (ui_manager, action_group, merge_id, popup_bg_path, uri, name, pixbuf, FALSE);
-	g_object_unref (pixbuf);
+	if (pixbuf) {
+		g_object_unref (pixbuf);
+	}
 	g_free (name);
 	g_free (uri);
 }
@@ -5142,8 +5144,6 @@
 		*dot = 0;
 	}
 
-	pixbuf = get_menu_icon_for_file (file);
-
 	action_name = escape_action_name (uri, "template_");
 	escaped_label = eel_str_double_underscores (name);
 	
@@ -5154,9 +5154,12 @@
 				 tip,
 				 NULL);
 	
-	g_object_set_data_full (G_OBJECT (action), "menu-icon",
-				g_object_ref (pixbuf),
-				g_object_unref);
+	pixbuf = get_menu_icon_for_file (file);
+	if (pixbuf != NULL) {
+		g_object_set_data_full (G_OBJECT (action), "menu-icon",
+					pixbuf,
+					g_object_unref);
+	}
 
 	g_signal_connect_data (action, "activate",
 			       G_CALLBACK (create_template_callback),
@@ -5185,7 +5188,6 @@
 			       GTK_UI_MANAGER_MENUITEM,
 			       FALSE);
 	
-	g_object_unref (pixbuf);
 	g_free (escaped_label);
 	g_free (name);
 	g_free (tip);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]