[nautilus/wip/oholy/ci-failures: 6/6] progress-info: Prevent abortion caused by missing locks



commit f3aadd68fdc1a3eec8d90a092674632443a0c85e
Author: Ondrej Holy <oholy redhat com>
Date:   Mon Feb 3 10:15:29 2020 +0100

    progress-info: Prevent abortion caused by missing locks
    
    The test-file-operations-move-files and test-file-operations-copy-files
    test cases randomly crash with "GLib-FATAL-CRITICAL: g_source_is_destroyed:
    assertion 'g_atomic_int_get (&source->ref_count) > 0' failed", which causes
    GitLab CI pipeline failures among others, which is a shame.
    
    I am not able to reproduce those crashes locally, so I can't easily verify
    the call stack, but only place where `g_source_destroy()` is called is
    when handling progress infos. I see two potential issues which might cause
    this. Let's try to fix them.

 src/nautilus-progress-info.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-progress-info.c b/src/nautilus-progress-info.c
index 45f2842a9..e44d34dcc 100644
--- a/src/nautilus-progress-info.c
+++ b/src/nautilus-progress-info.c
@@ -191,10 +191,10 @@ idle_callback (gpointer data)
     gboolean cancelled_at_idle;
     GSource *source;
 
-    source = g_main_current_source ();
-
     G_LOCK (progress_info);
 
+    source = g_main_current_source ();
+
     /* Protect agains races where the source has
      *  been destroyed on another thread while it
      *  was being dispatched.
@@ -309,8 +309,8 @@ set_details_in_thread (GTask                *task,
 {
     if (!g_cancellable_is_cancelled (cancellable))
     {
-        set_details (info, _("Canceled"));
         G_LOCK (progress_info);
+        set_details (info, _("Canceled"));
         info->cancel_at_idle = TRUE;
         g_timer_stop (info->progress_timer);
         queue_idle (info, TRUE);


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