diff options
author | Thomas Wood <thomas.wood@intel.com> | 2011-12-15 14:36:55 +0000 |
---|---|---|
committer | Thomas Wood <thomas.wood@intel.com> | 2011-12-20 14:11:25 +0000 |
commit | 4e85d2627293ba248ac9e8b619c4dbb5859a9b3c (patch) | |
tree | c4a3f9932d38853386d7c60a96c8dfdbe7d73f6f | |
parent | 23f7c03ac8e67b72f6bf9111fcfe4ed959a99c0a (diff) | |
download | clutter-gst-4e85d2627293ba248ac9e8b619c4dbb5859a9b3c.tar.gz |
gst-player: take a reference on the player when adding an idle function
When adding an idle function that uses the player object, add a reference
to the object to ensure it is still valid when the idle function is called.
-rw-r--r-- | clutter-gst/clutter-gst-player.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/clutter-gst/clutter-gst-player.c b/clutter-gst/clutter-gst-player.c index e35ec61..eb2bd19 100644 --- a/clutter-gst/clutter-gst-player.c +++ b/clutter-gst/clutter-gst-player.c @@ -1200,6 +1200,8 @@ on_volume_changed_main_context (gpointer data) g_object_notify (G_OBJECT (player), "audio-volume"); + g_object_unref (player); + return FALSE; } @@ -1212,7 +1214,7 @@ on_volume_changed (GstElement *pipeline, GParamSpec *pspec, ClutterGstPlayer *player) { - g_idle_add (on_volume_changed_main_context, player); + g_idle_add (on_volume_changed_main_context, g_object_ref (player)); } static GList * @@ -1252,6 +1254,8 @@ on_audio_changed_main_context (gpointer data) g_object_notify (G_OBJECT (player), "audio-streams"); + g_object_unref (player); + return FALSE; } @@ -1260,7 +1264,7 @@ static void on_audio_changed (GstElement *pipeline, ClutterGstPlayer *player) { - g_idle_add (on_audio_changed_main_context, player); + g_idle_add (on_audio_changed_main_context, g_object_ref (player)); } static void @@ -1275,7 +1279,7 @@ on_audio_tags_changed (GstElement *pipeline, if (current_stream != stream) return; - g_idle_add (on_audio_changed_main_context, player); + g_idle_add (on_audio_changed_main_context, g_object_ref (player)); } static gboolean @@ -1286,6 +1290,8 @@ on_current_audio_changed_main_context (gpointer data) CLUTTER_GST_NOTE (AUDIO_STREAM, "audio stream changed"); g_object_notify (G_OBJECT (player), "audio-stream"); + g_object_unref (player); + return FALSE; } @@ -1294,7 +1300,7 @@ on_current_audio_changed (GstElement *pipeline, GParamSpec *pspec, ClutterGstPlayer *player) { - g_idle_add (on_current_audio_changed_main_context, player); + g_idle_add (on_current_audio_changed_main_context, g_object_ref (player)); } static gboolean @@ -1310,6 +1316,8 @@ on_text_changed_main_context (gpointer data) g_object_notify (G_OBJECT (player), "subtitle-tracks"); + g_object_unref (player); + return FALSE; } @@ -1318,7 +1326,7 @@ static void on_text_changed (GstElement *pipeline, ClutterGstPlayer *player) { - g_idle_add (on_text_changed_main_context, player); + g_idle_add (on_text_changed_main_context, g_object_ref (player)); } static void @@ -1326,7 +1334,7 @@ on_text_tags_changed (GstElement *pipeline, gint stream, ClutterGstPlayer *player) { - g_idle_add (on_text_changed_main_context, player); + g_idle_add (on_text_changed_main_context, g_object_ref (player)); } static gboolean @@ -1337,6 +1345,8 @@ on_current_text_changed_main_context (gpointer data) CLUTTER_GST_NOTE (AUDIO_STREAM, "text stream changed"); g_object_notify (G_OBJECT (player), "subtitle-track"); + g_object_unref (player); + return FALSE; } @@ -1345,7 +1355,7 @@ on_current_text_changed (GstElement *pipeline, GParamSpec *pspec, ClutterGstPlayer *player) { - g_idle_add (on_current_text_changed_main_context, player); + g_idle_add (on_current_text_changed_main_context, g_object_ref (player)); } /* GObject's magic/madness */ |