[PATCH 5/5] youtube: Do not leak stored operation data
- From: "Juan A. Suarez Romero" <jasuarez igalia com>
- To: grilo-list gnome org
- Subject: [PATCH 5/5] youtube: Do not leak stored operation data
- Date: Fri, 15 Apr 2011 09:55:15 +0200
Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>
---
src/media/youtube/grl-youtube.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/media/youtube/grl-youtube.c b/src/media/youtube/grl-youtube.c
index fd6b514..451ecdc 100644
--- a/src/media/youtube/grl-youtube.c
+++ b/src/media/youtube/grl-youtube.c
@@ -414,6 +414,18 @@ grl_youtube_source_finalize (GObject *object)
/* ======================= Utilities ==================== */
+static void
+release_operation_data (GrlMetadataSource *source,
+ guint operation_id)
+{
+ GCancellable *cancellable = grl_metadata_source_get_operation_data (source,
+ operation_id);
+
+ if (cancellable) {
+ g_object_unref (cancellable);
+ }
+}
+
static OperationSpec *
operation_spec_new ()
{
@@ -910,6 +922,7 @@ static void
build_media_from_entry_metadata_cb (GrlMedia *media, gpointer user_data)
{
GrlMediaSourceMetadataSpec *ms = (GrlMediaSourceMetadataSpec *) user_data;
+ release_operation_data (GRL_METADATA_SOURCE (ms->source), ms->metadata_id);
ms->callback (ms->source, ms->metadata_id, media, ms->user_data, NULL);
}
@@ -987,6 +1000,7 @@ metadata_cb (GObject *object,
(GDATA_YOUTUBE_SERVICE (service), result, &error));
#endif
if (error) {
+ release_operation_data (GRL_METADATA_SOURCE (ms->source), ms->metadata_id);
error->code = GRL_CORE_ERROR_METADATA_FAILED;
ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, error);
g_error_free (error);
@@ -1380,6 +1394,8 @@ build_media_from_entry_media_from_uri_cb (GrlMedia *media, gpointer user_data)
{
GrlMediaSourceMediaFromUriSpec *mfus =
(GrlMediaSourceMediaFromUriSpec *) user_data;
+
+ release_operation_data (GRL_METADATA_SOURCE (mfus->source), mfus->media_from_uri_id);
mfus->callback (mfus->source, mfus->media_from_uri_id, media, mfus->user_data, NULL);
}
@@ -1406,6 +1422,7 @@ media_from_uri_cb (GObject *object, GAsyncResult *result, gpointer user_data)
if (error) {
error->code = GRL_CORE_ERROR_MEDIA_FROM_URI_FAILED;
+ release_operation_data (GRL_METADATA_SOURCE (mfus->source), mfus->media_from_uri_id);
mfus->callback (mfus->source, mfus->media_from_uri_id, NULL, mfus->user_data, error);
g_error_free (error);
} else {
--
1.7.4.1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]