[gnome-builder] mingw: hold reference during async startup



commit 7bf8668dd88a8ab518cc5220c013a3dfa8b6cc47
Author: Christian Hergert <christian hergert me>
Date:   Wed May 13 21:49:02 2015 -0700

    mingw: hold reference during async startup
    
    We were able to get into a situation with the unit tests where this thread
    func would not get called until after the context had been disposed. Since
    we need access to the context (but IdeObject is now allowed to take a full
    reference), we need to have a hold on the context.
    
    Should fix transient test failures.

 libide/mingw/ide-mingw-device-provider.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/libide/mingw/ide-mingw-device-provider.c b/libide/mingw/ide-mingw-device-provider.c
index f9f7f0f..5ab808b 100644
--- a/libide/mingw/ide-mingw-device-provider.c
+++ b/libide/mingw/ide-mingw-device-provider.c
@@ -80,6 +80,8 @@ ide_mingw_device_provider_discover_worker (GTask        *task,
     }
 
   g_task_return_pointer (task, devices, (GDestroyNotify)g_ptr_array_unref);
+
+  ide_object_release (IDE_OBJECT (self));
 }
 
 static void
@@ -117,6 +119,7 @@ ide_mingw_device_provider_constructed (GObject *object)
 
   g_assert (IDE_IS_MINGW_DEVICE_PROVIDER (self));
 
+  ide_object_hold (IDE_OBJECT (self));
   task = g_task_new (self, NULL, load_cb, NULL);
   g_task_run_in_thread (task, ide_mingw_device_provider_discover_worker);
 }


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