[tracker-miners/wip/carlosg/shuffle-libtracker-miner: 113/116] Avoid g_critical() warning triggered by D-Bus API



commit 2a0261504ab06737d7c0e5bf4c625e9b4f3960af
Author: Sam Thursfield <sam afuera me uk>
Date:   Sat Sep 21 12:47:40 2019 +0200

    Avoid g_critical() warning triggered by D-Bus API
    
    Calling the org.freedesktop.Tracker.Miner Start() method could trigger
    a g_critical() warning if the miner was already started:
    
        Tracker-CRITICAL **: 10:32:39.592: tracker_miner_start: assertion 'miner->priv->started == FALSE' 
failed'
    
    Callers of the D-Bus API have no reliable way to know if the miner
    is already running, so we should just remove the warning and allow
    tracker_miner_start() to be called even when the miner is running.
    The same is true of Stop().

 src/libtracker-miner/tracker-miner-object.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-object.c b/src/libtracker-miner/tracker-miner-object.c
index 20d4591eb..37c46b417 100644
--- a/src/libtracker-miner/tracker-miner-object.c
+++ b/src/libtracker-miner/tracker-miner-object.c
@@ -495,10 +495,11 @@ void
 tracker_miner_start (TrackerMiner *miner)
 {
        g_return_if_fail (TRACKER_IS_MINER (miner));
-       g_return_if_fail (miner->priv->started == FALSE);
 
-       miner->priv->started = TRUE;
-       g_signal_emit (miner, signals[STARTED], 0);
+       if (miner->priv->started == FALSE) {
+               miner->priv->started = TRUE;
+               g_signal_emit (miner, signals[STARTED], 0);
+       }
 }
 
 /**
@@ -513,10 +514,11 @@ void
 tracker_miner_stop (TrackerMiner *miner)
 {
        g_return_if_fail (TRACKER_IS_MINER (miner));
-       g_return_if_fail (miner->priv->started == TRUE);
 
-       miner->priv->started = FALSE;
-       g_signal_emit (miner, signals[STOPPED], 0);
+       if (miner->priv->started == TRUE) {
+               miner->priv->started = FALSE;
+               g_signal_emit (miner, signals[STOPPED], 0);
+       }
 }
 
 /**


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