nautilus r14431 - in trunk: . libnautilus-private



Author: cneumair
Date: Thu Jul 31 10:52:36 2008
New Revision: 14431
URL: http://svn.gnome.org/viewvc/nautilus?rev=14431&view=rev

Log:
2008-07-31  Christian Neumair  <cneumair gnome org>

	* libnautilus-private/nautilus-autorun.c
	(remove_elem_from_str_array), (add_elem_to_str_array),
	(nautilus_autorun_set_preferences), (combo_box_changed),
	(nautilus_autorun_prepare_combo_box):
	Handle NULL string arrays, and fix combo box model reference counting.
	Fixes #545658.


Modified:
   trunk/ChangeLog
   trunk/libnautilus-private/nautilus-autorun.c

Modified: trunk/libnautilus-private/nautilus-autorun.c
==============================================================================
--- trunk/libnautilus-private/nautilus-autorun.c	(original)
+++ trunk/libnautilus-private/nautilus-autorun.c	Thu Jul 31 10:52:36 2008
@@ -103,6 +103,11 @@
 remove_elem_from_str_array (char **v, const char *s)
 {
 	int n, m;
+
+	if (v == NULL) {
+		return;
+	}
+
 	for (n = 0; v[n] != NULL; n++) {
 		if (strcmp (v[n], s) == 0) {
 			for (m = n + 1; v[m] != NULL; m++) {
@@ -120,7 +125,7 @@
 	guint len;
 	char **r;
 
-	len = g_strv_length (v);
+	len = v != NULL ? g_strv_length (v) : 0;
 	r = g_new0 (char *, len + 2);
 	memcpy (r, v, len * sizeof (char *));
 	r[len] = g_strdup (s);
@@ -141,6 +146,8 @@
 	char **x_content_ignore;
 	char **x_content_open_folder;
 
+	g_assert (x_content_type != NULL);
+
 	x_content_start_app = eel_preferences_get_string_array (NAUTILUS_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_START_APP);
 	x_content_ignore = eel_preferences_get_string_array (NAUTILUS_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_IGNORE);
 	x_content_open_folder = eel_preferences_get_string_array (NAUTILUS_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER);
@@ -328,9 +335,6 @@
 	if (app_info != NULL) {
 		g_object_unref (app_info);
 	}
-	if (model != NULL) {
-		g_object_unref (model);
-	}
 	g_free (x_content_type);
 }
 
@@ -584,6 +588,7 @@
 	eel_g_object_list_free (app_info_list);
 
 	gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (list_store));
+	g_object_unref (G_OBJECT (list_store));
 
 	gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo_box));
 



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