[gnome-online-miners/wip/rishi/insert-share: 2/24] miner: Let GomAccountMinerJob own a reference to the connection



commit 94b4461c35c4c6e440d941d1bd7dd3552365b610
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Sep 2 13:44:04 2016 +0200

    miner: Let GomAccountMinerJob own a reference to the connection
    
    This makes the code more readable and robust against refactorings.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770889

 src/gom-miner.c |    3 ++-
 src/gom-miner.h |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/gom-miner.c b/src/gom-miner.c
index ec42464..18979ad 100644
--- a/src/gom-miner.c
+++ b/src/gom-miner.c
@@ -56,6 +56,7 @@ gom_account_miner_job_free (GomAccountMinerJob *job)
   g_hash_table_unref (job->services);
   g_clear_object (&job->miner);
   g_clear_object (&job->account);
+  g_clear_object (&job->connection);
   g_clear_object (&job->async_result);
 
   g_free (job->datasource_urn);
@@ -382,7 +383,7 @@ gom_account_miner_job_new (GomMiner *self,
   retval->miner = g_object_ref (self);
   retval->cancellable = g_cancellable_new ();
   retval->account = account;
-  retval->connection = self->priv->connection;
+  retval->connection = g_object_ref (self->priv->connection);
   retval->previous_resources =
     g_hash_table_new_full (g_str_hash, g_str_equal,
                            (GDestroyNotify) g_free, (GDestroyNotify) g_free);
diff --git a/src/gom-miner.h b/src/gom-miner.h
index fe28907..4675f12 100644
--- a/src/gom-miner.h
+++ b/src/gom-miner.h
@@ -60,7 +60,7 @@ typedef struct _GomMinerPrivate GomMinerPrivate;
 
 typedef struct {
   GomMiner *miner;
-  TrackerSparqlConnection *connection; /* borrowed from GomMiner */
+  TrackerSparqlConnection *connection;
   gulong miner_cancellable_id;
 
   GoaAccount *account;


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