[gnome-builder/gnome-builder-3-28] flatpak: ensure widget access after task propagation

commit 51ecfb4108c73b572ca8b2949daaa51972eaf25d
Author: Christian Hergert <chergert redhat com>
Date:   Sun Jul 8 01:16:27 2018 +0200

    flatpak: ensure widget access after task propagation
    Normally, we dispose of the source_object and task_data when the
    IdeTask propagates the return value. This helps ensure that we
    avoid leaks and protect against objects finalized in the wrong
    thread. However, we need access to the widget in this case so
    we need to keep the source_object around.
    We still get the protection from the threaded worker sending the
    result back with the task reference.
    Fixes #560

 src/plugins/flatpak/gbp-flatpak-clone-widget.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/src/plugins/flatpak/gbp-flatpak-clone-widget.c b/src/plugins/flatpak/gbp-flatpak-clone-widget.c
index 4f9dc9b59..d4c7b2875 100644
--- a/src/plugins/flatpak/gbp-flatpak-clone-widget.c
+++ b/src/plugins/flatpak/gbp-flatpak-clone-widget.c
@@ -584,6 +584,8 @@ gbp_flatpak_clone_widget_clone_async (GbpFlatpakCloneWidget   *self,
   g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
   task = ide_task_new (self, cancellable, callback, user_data);
+  ide_task_set_source_tag (task, gbp_flatpak_clone_widget_clone_async);
+  ide_task_set_release_on_propagate (task, FALSE);
   src = get_source (self, &error);
   if (src == NULL)

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