[PATCH 05/17] tracker: avoid using the same media instance



From: Lionel Landwerlin <lionel g landwerlin linux intel com>

Don't notify multiple objects removal with the same media instance.

Signed-off-by: Lionel Landwerlin <lionel g landwerlin linux intel com>
---
 src/media/tracker/grl-tracker-notif.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/media/tracker/grl-tracker-notif.c b/src/media/tracker/grl-tracker-notif.c
index 52f061d..9194eac 100644
--- a/src/media/tracker/grl-tracker-notif.c
+++ b/src/media/tracker/grl-tracker-notif.c
@@ -289,7 +289,6 @@ tracker_evt_update_orphans (tracker_evt_update_t *evt)
     return;
   }
 
-  media = grl_media_new ();
   sources = grl_plugin_registry_get_sources (grl_plugin_registry_get_default (),
 					     FALSE);
 
@@ -305,6 +304,7 @@ tracker_evt_update_orphans (tracker_evt_update_t *evt)
       break;
     } else {
       /* Notify all sources that a been removed */
+      media = grl_media_new ();
       str_id = g_strdup_printf ("%u", id);
       grl_media_set_id (media, str_id);
       g_free (str_id);
@@ -321,6 +321,7 @@ tracker_evt_update_orphans (tracker_evt_update_t *evt)
 	}
 	source = source->next;
       }
+      g_object_unref (media);
     }
     subject = subject->next;
   }
@@ -334,6 +335,7 @@ tracker_evt_update_orphans (tracker_evt_update_t *evt)
 	g_string_append_printf (request_str, ", %u", id);
       } else {
 	/* Notify all sources that a been removed */
+        media = grl_media_new ();
 	str_id = g_strdup_printf ("%u", id);
 	grl_media_set_id (media, str_id);
 	g_free (str_id);
@@ -350,6 +352,7 @@ tracker_evt_update_orphans (tracker_evt_update_t *evt)
 	  }
 	  source = source->next;
 	}
+        g_object_unref (media);
       }
       subject = subject->next;
     }
@@ -368,7 +371,6 @@ tracker_evt_update_orphans (tracker_evt_update_t *evt)
     tracker_evt_postupdate_sources (evt);
   }
 
-  g_object_unref (media);
   g_string_free (request_str, TRUE);
 }
 
-- 
1.7.4.1



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