[gnome-software/1756-include-gnome-software-and-dependencies-versions-in-debug-log-output] Apply 2 suggestion(s) to 1 file(s)



commit 710ee05cac1e37f3773ed56f681caab7213aaaf3
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon May 16 14:56:40 2022 +0000

    Apply 2 suggestion(s) to 1 file(s)

 lib/gs-debug.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/lib/gs-debug.c b/lib/gs-debug.c
index 308a868bf..1baf04cc2 100644
--- a/lib/gs-debug.c
+++ b/lib/gs-debug.c
@@ -274,13 +274,11 @@ gs_debug_set_verbose (GsDebug  *self,
 {
        g_return_if_fail (GS_IS_DEBUG (self));
 
-       if (!g_atomic_int_get (&self->verbose) == !verbose)
-               return;
-
-       g_atomic_int_set (&self->verbose, verbose);
-
-       if (verbose) {
-               GsOsRelease *os_release;
+       /* If we’re changing from !verbose → verbose, print OS information.
+        * This is helpful in verbose logs when people file bug reports. */
+       if (g_atomic_int_compare_and_exchange (&self->verbose, !verbose, verbose) &&
+           verbose) {
+               g_autoptr(GsOsRelease) os_release = NULL;
                g_autoptr(GError) error = NULL;
 
                g_debug (PACKAGE_NAME " " PACKAGE_VERSION);


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