[Rhythmbox-devel] Patch to make D-Bus and Podcasts play nice



The recently-enhanced D-Bus interface doesn't play nicely with the
recently-added podcast support in CVS.  When a D-Bus client invokes
getSongProperties, the rb_shell_get_song_properties function is called.
This function tries to read every property in the specified RhythmDB
entry.  When it tries to read properties related to podcasts,
rhythmdb_entry_get_(string|ulong) dereferences a null pointer
(entry->podcast) and causes Rhythmbox to crash.

The attached simple patch modifies rhythmdb_entry_get_string and
rhythmdb_entry_get_ulong to check if entry->podcast is null before
dereferencing it.

The patch seems to fix the problem, at least with a few minutes' worth
of testing.
? podcast/Makefile.in
? podcast/rb-podcast-marshal.c
? podcast/rb-podcast-marshal.h
Index: rhythmdb/rhythmdb.h
===================================================================
RCS file: /cvs/gnome/rhythmbox/rhythmdb/rhythmdb.h,v
retrieving revision 1.51
diff -u -r1.51 rhythmdb.h
--- rhythmdb/rhythmdb.h	20 Oct 2005 16:42:16 -0000	1.51
+++ rhythmdb/rhythmdb.h	21 Oct 2005 02:42:51 -0000
@@ -257,17 +257,35 @@
 		return rb_refstring_get (entry->first_seen_str);
 //podcast propriets
 	case RHYTHMDB_PROP_DESCRIPTION:
-		return rb_refstring_get (entry->podcast->description);
+		if (entry->podcast)
+			return rb_refstring_get (entry->podcast->description);
+		else
+			return NULL;
 	case RHYTHMDB_PROP_SUBTITLE:
-		return rb_refstring_get (entry->podcast->subtitle);
+		if (entry->podcast)
+			return rb_refstring_get (entry->podcast->subtitle);
+		else
+			return NULL;
 	case RHYTHMDB_PROP_SUMMARY: 
-		return rb_refstring_get (entry->podcast->summary);
+		if (entry->podcast)
+			return rb_refstring_get (entry->podcast->summary);
+		else
+			return NULL;
 	case RHYTHMDB_PROP_LANG:
-		return rb_refstring_get (entry->podcast->lang);
+		if (entry->podcast)
+			return rb_refstring_get (entry->podcast->lang);
+		else
+			return NULL;
 	case RHYTHMDB_PROP_COPYRIGHT:
-		return rb_refstring_get (entry->podcast->copyright);
+		if (entry->podcast)
+			return rb_refstring_get (entry->podcast->copyright);
+		else
+			return NULL;
 	case RHYTHMDB_PROP_IMAGE:
-		return rb_refstring_get (entry->podcast->image);
+		if (entry->podcast)
+			return rb_refstring_get (entry->podcast->image);
+		else
+			return NULL;
 	default:
 		g_assert_not_reached ();
 		return NULL;
@@ -323,9 +341,15 @@
 	case RHYTHMDB_PROP_BITRATE:
 		return entry->bitrate;		
 	case RHYTHMDB_PROP_POST_TIME:
-		return entry->podcast->post_time;
+		if (entry->podcast)
+			return entry->podcast->post_time;
+		else
+			return 0;
 	case RHYTHMDB_PROP_STATUS:
-		return entry->podcast->status;		
+		if (entry->podcast)
+			return entry->podcast->status;		
+		else
+			return 0;
 	default:
 		g_assert_not_reached ();
 		return 0;

Attachment: signature.asc
Description: Digital signature



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