pidgin: bbef7cf1: vvconfig: Don't crash when the stored de...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Sat Jan 22 03:50:37 EST 2011


----------------------------------------------------------------------
Revision: bbef7cf10a9629d710dbb4b4e0843c6e1edf6c68
Parent:   b92b4735bd37fc251489a8cb3f4f9f1cff3e1674
Author:   jakub.adam at ktknet.cz
Date:     01/22/11 03:42:12
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/bbef7cf10a9629d710dbb4b4e0843c6e1edf6c68

Changelog: 

vvconfig: Don't crash when the stored device isn't found in the list of
available devices.  Fixes #13238.

Changes against parent b92b4735bd37fc251489a8cb3f4f9f1cff3e1674

  patched  ChangeLog
  patched  pidgin/plugins/vvconfig.c

-------------- next part --------------
============================================================
--- ChangeLog	fa4fea69a3db84b490e0b9b27f25e7ebcbb02aa2
+++ ChangeLog	da4383633b03c5fba06db0b715dd282878f8b11a
@@ -36,6 +36,9 @@ version 2.7.10 (??/??/????):
 	Plugins:
 	* The Voice/Video Settings plugin no longer resets selected devices to
 	  defaults. (Jakub Adam) (#13044)
+	* The Voice/Video Settings plugin no longer crashes when a stored device
+	  name is not found in the list of available devices. (Jakub Adam)
+	  (#13238)
 	* The Autoaccept plugin now allows disabling filename escaping. (Rok
 	  Mandeljc) (half of #11459)
 	* The Autoaccept plugin now allows choosing Reject/Ask/Accept for
============================================================
--- pidgin/plugins/vvconfig.c	ab08b25dfaefbd4213c2ff227fb2cba527f64148
+++ pidgin/plugins/vvconfig.c	9749f4a04fc225ace70d52e601361e35e813c037
@@ -82,20 +82,11 @@ get_element_devices(const gchar *element
 	GstPropertyProbe *probe;
 	const GParamSpec *pspec;
 
-	if (!strcmp(element_name, "<custom>")) {
-		ret = g_list_prepend(ret, NULL);
-		ret = g_list_prepend(ret, (gpointer)_("Default"));
-		ret = g_list_prepend(ret, "");
-		return ret;
-	}
-
 	ret = g_list_prepend(ret, (gpointer)_("Default"));
 	ret = g_list_prepend(ret, "");
 
-	if (*element_name == '\0') {
-		ret = g_list_prepend(ret, NULL);
-		ret = g_list_reverse(ret);
-		return ret;
+	if (!strcmp(element_name, "<custom>") || (*element_name == '\0')) {
+		return g_list_reverse(ret);
 	}
 
 	element = gst_element_factory_make(element_name, "test");
@@ -120,9 +111,7 @@ get_element_devices(const gchar *element
 		array = gst_property_probe_probe_and_get_values (probe, pspec);
 		if (array == NULL) {
 			purple_debug_info("vvconfig", "'%s' has no devices\n", element_name);
-			ret = g_list_prepend(ret, NULL);
-			ret = g_list_reverse(ret);
-			return ret;
+			return g_list_reverse(ret);
 		}
 
 		for (n=0; n < array->n_values; ++n) {
@@ -153,10 +142,7 @@ get_element_devices(const gchar *element
 	}
 	gst_object_unref(element);
 
-	ret = g_list_prepend(ret, NULL);
-	ret = g_list_reverse(ret);
-
-	return ret;
+	return g_list_reverse(ret);
 }
 
 static GList *
@@ -173,7 +159,6 @@ get_element_plugins(const gchar **plugin
 			ret = g_list_prepend(ret, (gpointer)plugins[0]);
 		}
 	}
-	ret = g_list_prepend(ret, NULL);
 	ret = g_list_reverse(ret);
 	return ret;
 }
@@ -236,7 +221,8 @@ device_changed_cb(const gchar *name, Pur
 	pref = g_strdup(name);
 	strcpy(pref + strlen(pref) - strlen("plugin"), "device");
 	devices = get_element_devices(value);
-	if (g_list_find(devices, purple_prefs_get_string(pref)) == NULL)
+	if (g_list_find_custom(devices, purple_prefs_get_string(pref),
+			(GCompareFunc)strcmp) == NULL)
 		purple_prefs_set_string(pref, g_list_next(devices)->data);
 	widget = pidgin_prefs_dropdown_from_list(parent,
 			label, PURPLE_PREF_STRING,


More information about the Commits mailing list