soc.2008.vv: ff590a90: Fix crash when gstreamer audio or video ...
maiku at soc.pidgin.im
maiku at soc.pidgin.im
Sat Aug 16 16:30:44 EDT 2008
-----------------------------------------------------------------
Revision: ff590a90a6aa3b7dfa2f25f23daae27d3276f5b2
Ancestor: cf532e43f57d6be724178e89e68c332876020e46
Author: maiku at soc.pidgin.im
Date: 2008-08-16T20:22:41
Branch: im.pidgin.soc.2008.vv
URL: http://d.pidgin.im/viewmtn/revision/info/ff590a90a6aa3b7dfa2f25f23daae27d3276f5b2
Modified files:
libpurple/media.c libpurple/media.h pidgin/gtkprefs.c
ChangeLog:
Fix crash when gstreamer audio or video factory can't be found. References #6605
-------------- next part --------------
============================================================
--- libpurple/media.c 6eaee0a0d94190d2bb428ce2eac5b7f9fa0478f5
+++ libpurple/media.c d42f8f9dbb8438547fa985c526ff5a8239dd7b1a
@@ -749,7 +749,12 @@ purple_media_get_element(const gchar *fa
purple_media_get_element(const gchar *factory_name)
{
GstElementFactory *factory = gst_element_factory_find(factory_name);
- GstElement *element = gst_element_factory_create(factory, NULL);
+ GstElement *element;
+
+ if (factory == NULL)
+ return NULL;
+
+ element = gst_element_factory_create(factory, NULL);
gst_object_unref(factory);
return element;
}
============================================================
--- libpurple/media.h e7985003cbf0cb7927bd6230b214483ab1069994
+++ libpurple/media.h 1d5e73fca5994713b56019953ad291b02617ebfc
@@ -335,7 +335,7 @@ GValue *purple_media_element_get_device(
*
* @param factory_name Name of the factory to create an element from.
*
- * @return The element that was created.
+ * @return The element that was created, NULL if it couldn't find the factory.
*/
GstElement *purple_media_get_element(const gchar *factory_name);
============================================================
--- pidgin/gtkprefs.c 3fca23c1ef9d1fab47d89352b911586966be97d9
+++ pidgin/gtkprefs.c c34ab7825610fde4bbcfee4952590d9d06ecbaa7
@@ -2112,11 +2112,15 @@ media_plugin_changed_cb(const gchar *nam
const char *plugin = value;
const char *device = purple_prefs_get_string("/purple/media/video/device");
GstElement *video = purple_media_get_element(plugin);
- GList *video_devices = purple_media_get_devices(video);
- GList *video_items = get_device_items(video, video_devices);
+ GList *video_items = NULL;
GList *list;
- g_list_free(video_devices);
+ if (video != NULL) {
+ GList *video_devices = purple_media_get_devices(video);
+ video_items = get_device_items(video, video_devices);
+ g_list_free(video_devices);
+ }
+
if (video_items == NULL) {
video_items = g_list_prepend(video_items, g_strdup(""));
video_items = g_list_prepend(video_items, g_strdup("Default"));
@@ -2165,14 +2169,20 @@ media_page()
GstElement *video = purple_media_get_element(plugin);
GstElement *audio = purple_media_get_element("alsasrc");
- GList *video_devices = purple_media_get_devices(video);
- GList *audio_devices = purple_media_get_devices(audio);
+ GList *video_items = NULL;
+ GList *audio_items = NULL;
- GList *video_items = get_device_items(video, video_devices);
- GList *audio_items = get_device_items(audio, audio_devices);
+ if (video != NULL) {
+ GList *video_devices = purple_media_get_devices(video);
+ video_items = get_device_items(video, video_devices);
+ g_list_free(video_devices);
+ }
- g_list_free(video_devices);
- g_list_free(audio_devices);
+ if (audio != NULL) {
+ GList *audio_devices = purple_media_get_devices(audio);
+ audio_items = get_device_items(audio, audio_devices);
+ g_list_free(audio_devices);
+ }
if (video_items == NULL) {
video_items = g_list_prepend(video_items, "");
More information about the Commits
mailing list