[libgweather/wip/hadess/fix-entry-warning] GWeatherLocation: Fix warning on entry exit



commit c50aad90d572e3f2300b5f35b89b8085d0e88679
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Mar 1 17:26:47 2019 +0100

    GWeatherLocation: Fix warning on entry exit
    
    The world is not supposed to be unref'ed "by hand", but any extra
    references can be dropped. This fixes a warning on exit when destroying
    a location entry.
    
     #0  0x00007ffff775d295 in _g_log_abort (breakpoint=1) at glib/glib/gmessages.c:554
     #1  0x00007ffff775e4a9 in g_logv (log_domain=0x7ffff7fc1cc1 "GWeather", log_level=G_LOG_LEVEL_CRITICAL, 
format=<optimized out>, args=args@entry=0x7fffffffc988)
        at glib/glib/gmessages.c:1371
     #2  0x00007ffff775e662 in g_log (log_domain=<optimized out>, log_level=<optimized out>, 
format=<optimized out>) at glib/glib/gmessages.c:1413
     #3  0x00007ffff7fb765d in gweather_location_unref (loc=0x642c90) at 
libgweather/libgweather/gweather-location.c:548
     #4  0x00007ffff7fba914 in finalize (object=0x56d230) at 
libgweather/libgweather/gweather-location-entry.c:149
    
    Fixes: 96d1ac2

 libgweather/gweather-location.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/libgweather/gweather-location.c b/libgweather/gweather-location.c
index 81fc122..6db89a1 100644
--- a/libgweather/gweather-location.c
+++ b/libgweather/gweather-location.c
@@ -545,7 +545,7 @@ void
 gweather_location_unref (GWeatherLocation *loc)
 {
     g_return_if_fail (loc != NULL);
-    g_return_if_fail (loc->level != GWEATHER_LOCATION_WORLD);
+    g_return_if_fail (loc->level != GWEATHER_LOCATION_WORLD || loc->ref_count > 1);
 
     _gweather_location_unref_no_check (loc);
 }


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