# HG changeset patch # User jakub.adam@ktknet.cz # Date 1295685732 0 # Node ID 2b63df6e495c2ec60eb3933236dff3f7babd4312 # Parent 66fe4bda9a85c426f6af9157c14efbcd6725b9af vvconfig: Don't crash when the stored device isn't found in the list of available devices. Fixes #13238. committer: John Bailey diff -r 66fe4bda9a85 -r 2b63df6e495c ChangeLog --- a/ChangeLog Sat Jan 22 08:32:31 2011 +0000 +++ b/ChangeLog Sat Jan 22 08:42:12 2011 +0000 @@ -36,6 +36,9 @@ 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 diff -r 66fe4bda9a85 -r 2b63df6e495c pidgin/plugins/vvconfig.c --- a/pidgin/plugins/vvconfig.c Sat Jan 22 08:32:31 2011 +0000 +++ b/pidgin/plugins/vvconfig.c Sat Jan 22 08:42:12 2011 +0000 @@ -82,20 +82,11 @@ GstPropertyProbe *probe; const GParamSpec *pspec; - if (!strcmp(element_name, "")) { - 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, "") || (*element_name == '\0')) { + return g_list_reverse(ret); } element = gst_element_factory_make(element_name, "test"); @@ -120,9 +111,7 @@ 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 @@ } 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 @@ 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 @@ 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,