Re: [Tracker] Refactored the src/plugins & (new) Evolution support



Philip Van Hoof wrote:
On Wed, 2009-02-11 at 17:55 +0000, Martyn Russell wrote
You can also just use git on this (branch is called push):

http://git.codethink.co.uk/?p=tracker;a=shortlog;h=push

OK thanks.

#2, Before we go on, can you explain ALL the libraries and what they do. From the names I don't really have any concept of what they are supposed to be doing. As far as I can see, we have:

  - libtracker_evolution_indexer.la (now renamed)
  - libtracker-evolution-daemon-module.la
  - libtracker-evolution-indexer-module.la
  - ...

*-indexer-module.la is an 'indexer' module which runs in
tracker-indexer. It will pump the data actually into the database.

*-daemon-module.la is a 'deamon' module which runs in trackerd. It will
receive the data from the external application (presumably over DBus)
and it will 'pass it on' to the *-indexer-module.la.

The first thing that I think here is, why do we need both? Especially if we are going to be moving the crawling and queueing all in to the indexer anyway (at a later date). Is it just so we have a permanent entity (trackerd) always available to receive data? Is there some other reason?

#13, For the cases where we reference another object here, we need to make sure we reference the new object first. We do this to protect ourselves from unreferencing the same object we are about to reference, (in the unlikely event that we set the object to the same object we already have in priv->object):

+void
+tracker_push_registrar_set_object (TrackerPushRegistrar *registrar,
+                                  GObject              *object)
+{
+       TrackerPushRegistrarPrivate *priv;
+
+       priv = TRACKER_PUSH_REGISTRAR_GET_PRIVATE (registrar);
+
+       if (priv->object)
+               g_object_unref (priv->object);
+
+       if (object)
+               priv->object = g_object_ref (object);
+       else
+               priv->object = NULL;
+}
+

So, what is the problem here exactly?

Say priv->object = 0xdeadbeef. Say object (passed in as an argument to the function) is also 0xdeadbeef, both are the same object. The object has 1 reference. We then remove that reference (which finalizes it) and then we try to ref it again. It is better in these conditions to always ref the new object just in case we are silly enough somewhere to set the object to the same thing we already have set.

--
Regards,
Martyn



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