On Tue, 2005-08-23 at 21:29 -0400, Charles Schmidt wrote: > A recent CVS commit that hasn't filtered through to anonymous CVS > removed that function from rb-playlist-source.c & .h. Until it filters > through and/or I get real CVS access, a temporary fix is to add: <snip> > to sources/rb-playlist-source.c > > sorry about that, blame James :) The reason I removed it was a) it was broken, and using it could cause crashes and b) nothing (in cvs) was using it. The problem is that the query model can change at any time, and deallocate the memory, which wouldn't be good if you're in the middle of using it. This problem always existed - but was very unlikely to happen until my patch, which causes it to happen whenever a playlist is sorted. I've attached a patch which re-adds this as a GObject property, which means that it won't get deallocated from under you and you can also receive notification when it changes. Unless anyone has any problems with this I'll commit to it cvs. Cheers, James "Doc" Livingston -- Winter Summer Spring Summer Summer Autumn Spring Haiku. Grammar? -- David Cameron Staples in ASR
diff -u -r1.67 rb-playlist-source.c --- sources/rb-playlist-source.c 24 Aug 2005 03:27:07 -0000 1.67 +++ sources/rb-playlist-source.c 24 Aug 2005 06:14:00 -0000 @@ -139,6 +139,7 @@ { PROP_0, PROP_AUTOMATIC, + PROP_QUERY_MODEL, PROP_DIRTY }; @@ -217,6 +218,14 @@ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (object_class, + PROP_QUERY_MODEL, + g_param_spec_object ("query-model", + "query-model", + "query model for the playlist", + RHYTHMDB_TYPE_QUERY_MODEL, + G_PARAM_READABLE)); + + g_object_class_install_property (object_class, PROP_DIRTY, g_param_spec_boolean ("dirty", "dirty", @@ -420,7 +429,9 @@ case PROP_DIRTY: g_value_set_boolean (value, source->priv->dirty); break; - + case PROP_QUERY_MODEL: + g_value_set_object (value, source->priv->model); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1036,4 +1047,7 @@ rb_entry_view_set_model (source->priv->songs, source->priv->model); rhythmdb_do_full_query_async_parsed (source->priv->db, GTK_TREE_MODEL (source->priv->model), query); + + /* emit notification the the property has changed */ + g_object_notify (G_OBJECT (source), "query-model"); }
Attachment:
signature.asc
Description: This is a digitally signed message part