[tracker-miners/sam/test-warning-fixes] Avoid g_critical() errors when unable to connect to upower



commit 0d11b245365f71aca4acf70c0be8bd7ed9e548d3
Author: Sam Thursfield <sam afuera me uk>
Date:   Wed Jul 10 15:39:40 2019 +0100

    Avoid g_critical() errors when unable to connect to upower
    
    This removes two g_critical() errors that are seen when running the
    tests in CI.
    
    Before:
    
        (tracker-miner-fs:7050): libupower-glib-WARNING **: 14:31:50.109: Couldn't connect to proxy: Could 
not connect: No such file or directory
    
        (tracker-miner-fs:7050): GLib-GObject-CRITICAL **: 14:31:50.109: g_object_unref: assertion 
'G_IS_OBJECT (object)' failed
    
        (tracker-miner-fs:7050): GLib-GObject-CRITICAL **: 14:31:50.109: g_object_unref: assertion 
'G_IS_OBJECT (object)' failed
    
        ** (tracker-miner-fs:7050): WARNING **: 14:31:50.109: Unable to connect to UPower
    
    After:
    
        (tracker-miner-fs:12620): libupower-glib-WARNING **: 14:38:52.337: Couldn't connect to proxy: Could 
not connect: No such file or directory
    
        ** (tracker-miner-fs:12620): WARNING **: 14:38:52.337: Unable to connect to UPower
    
    Fixes https://gitlab.gnome.org/GNOME/tracker-miners/issues/75

 src/miners/fs/tracker-power-upower.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/miners/fs/tracker-power-upower.c b/src/miners/fs/tracker-power-upower.c
index 5dc5e8a08..ba583ba45 100644
--- a/src/miners/fs/tracker-power-upower.c
+++ b/src/miners/fs/tracker-power-upower.c
@@ -170,10 +170,10 @@ tracker_power_finalize (GObject *object)
        priv = GET_PRIV (object);
 
 #ifndef HAVE_UP_CLIENT_GET_ON_LOW_BATTERY
-       g_object_unref (priv->composite_device);
+       g_clear_object (&priv->composite_device);
 #endif /* HAVE_UP_CLIENT_GET_ON_LOW_BATTERY */
 
-       g_object_unref (priv->client);
+       g_clear_object (&priv->client);
 
        (G_OBJECT_CLASS (tracker_power_parent_class)->finalize) (object);
 }


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