[rhythmbox] generic-player: don't crash during playlist construction
- From: Jonathan Matthew <jmatthew src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rhythmbox] generic-player: don't crash during playlist construction
- Date: Thu, 24 Dec 2009 13:50:13 +0000 (UTC)
commit 568c06dba74678578402b02cc2d598b72f9fa66f
Author: Jonathan Matthew <jonathan d14n org>
Date: Thu Dec 24 23:43:45 2009 +1000
generic-player: don't crash during playlist construction
Since we use the GObject 'constructed' method rather than 'constructor'
in most places, the playlist base class isn't fully set up in the
generic player playlist class constructor, so trying to load the
playlist file there crashes. Now we load the playlist in
rb_generic_player_playlist_source_new, after the object is fully
constructed.
.../rb-generic-player-playlist-source.c | 50 ++++++++-----------
1 files changed, 21 insertions(+), 29 deletions(-)
---
diff --git a/plugins/generic-player/rb-generic-player-playlist-source.c b/plugins/generic-player/rb-generic-player-playlist-source.c
index 9d604c7..553cf5a 100644
--- a/plugins/generic-player/rb-generic-player-playlist-source.c
+++ b/plugins/generic-player/rb-generic-player-playlist-source.c
@@ -341,20 +341,31 @@ impl_mark_dirty (RBPlaylistSource *source)
RBSource *
rb_generic_player_playlist_source_new (RBShell *shell,
- RBGenericPlayerSource *source,
+ RBGenericPlayerSource *player_source,
const char *playlist_file,
const char *device_root,
RhythmDBEntryType entry_type)
{
- return RB_SOURCE (g_object_new (RB_TYPE_GENERIC_PLAYER_PLAYLIST_SOURCE,
- "shell", shell,
- "is-local", FALSE,
- "entry-type", entry_type,
- "source-group", RB_SOURCE_GROUP_DEVICES,
- "player-source", source,
- "playlist-path", playlist_file,
- "device-root", device_root,
- NULL));
+ RBSource *source;
+ source = RB_SOURCE (g_object_new (RB_TYPE_GENERIC_PLAYER_PLAYLIST_SOURCE,
+ "shell", shell,
+ "is-local", FALSE,
+ "entry-type", entry_type,
+ "source-group", RB_SOURCE_GROUP_DEVICES,
+ "player-source", player_source,
+ "playlist-path", playlist_file,
+ "device-root", device_root,
+ NULL));
+
+ if (load_playlist (RB_GENERIC_PLAYER_PLAYLIST_SOURCE (source)) == FALSE) {
+ rb_debug ("playlist didn't parse; killing the source");
+ if (g_object_is_floating (source))
+ g_object_ref_sink (source);
+ g_object_unref (source);
+ return NULL;
+ }
+
+ return source;
}
void
@@ -383,24 +394,6 @@ rb_generic_player_playlist_source_init (RBGenericPlayerPlaylistSource *source)
{
}
-static GObject *
-impl_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties)
-{
- RBGenericPlayerPlaylistSource *source;
-
- source = RB_GENERIC_PLAYER_PLAYLIST_SOURCE (G_OBJECT_CLASS (rb_generic_player_playlist_source_parent_class) -> constructor (type, n_construct_properties, construct_properties));
-
- if (load_playlist (source) == FALSE) {
- rb_debug ("playlist didn't parse; killing the source");
- if (g_object_is_floating (source))
- g_object_ref_sink (source);
- g_object_unref (source);
- return NULL;
- }
-
- return G_OBJECT (source);
-}
-
static void
impl_dispose (GObject *object)
{
@@ -520,7 +513,6 @@ rb_generic_player_playlist_source_class_init (RBGenericPlayerPlaylistSourceClass
RBSourceClass *source_class = RB_SOURCE_CLASS (klass);
RBPlaylistSourceClass *playlist_class = RB_PLAYLIST_SOURCE_CLASS (klass);
- object_class->constructor = impl_constructor;
object_class->dispose = impl_dispose;
object_class->finalize = impl_finalize;
object_class->get_property = impl_get_property;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]