[tracker/external-crawler] libtracker-miner: NULL protect TrackerMinerFS using :roots_to_notify



commit da12bcfad33f5b273317656cab354d345868f457
Author: Martyn Russell <martyn lanedo com>
Date:   Tue Aug 12 20:10:40 2014 +0100

    libtracker-miner: NULL protect TrackerMinerFS using :roots_to_notify

 src/libtracker-miner/tracker-miner-fs.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 115be5b..805ecd7 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -846,6 +846,9 @@ fs_finalize (GObject *object)
 
        if (priv->roots_to_notify) {
                g_hash_table_unref (priv->roots_to_notify);
+
+               /* Just in case we end up using this AFTER finalize, not expected */
+               priv->roots_to_notify = NULL;
        }
 
 #ifdef EVENT_QUEUE_ENABLE_TRACE
@@ -1070,7 +1073,9 @@ notify_roots_finished (TrackerMinerFS *fs,
        GHashTableIter iter;
        gpointer key, value;
 
-       if (check_queues && g_hash_table_size (fs->priv->roots_to_notify) < 2) {
+       if (check_queues &&
+           fs->priv->roots_to_notify &&
+           g_hash_table_size (fs->priv->roots_to_notify) < 2) {
                /* Technically, if there is only one root, it's
                 * pointless to do anything before the FINISHED (not
                 * FINISHED_ROOT) signal is emitted. In that
@@ -1079,6 +1084,10 @@ notify_roots_finished (TrackerMinerFS *fs,
                 * is really just for efficiency.
                 */
                return;
+       } else if (fs->priv->roots_to_notify == NULL ||
+                  g_hash_table_size (fs->priv->roots_to_notify) < 1) {
+               /* Nothing to do */
+               return;
        }
 
        g_hash_table_iter_init (&iter, fs->priv->roots_to_notify);


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