[gnome-control-center/printers-Do-not-cleanup-task-after-getting-bus] printers: Do not cleanup task after getting bus



commit 0f43ca4e6a9f97df8b886adfeeb8a20cde4ade11
Author: Marek Kasik <mkasik redhat com>
Date:   Thu Oct 29 17:14:31 2020 +0100

    printers: Do not cleanup task after getting bus
    
    Use g_steal_pointer() on task in get_bus_cb() in pp-printer.c
    to not invalidate a pointer passed to a DBus call.
    Cleanup the task in callback of the DBus call.

 panels/printers/pp-printer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/panels/printers/pp-printer.c b/panels/printers/pp-printer.c
index 70c580fde..fd478f9ad 100644
--- a/panels/printers/pp-printer.c
+++ b/panels/printers/pp-printer.c
@@ -152,7 +152,7 @@ printer_rename_dbus_cb (GObject      *source_object,
   g_autoptr(GVariant) output = NULL;
   gboolean            result = FALSE;
   g_autoptr(GError)   error = NULL;
-  GTask              *task = user_data;
+  g_autoptr(GTask)    task = user_data;
 
   output = g_dbus_connection_call_finish (G_DBUS_CONNECTION (source_object),
                                           res,
@@ -227,6 +227,7 @@ get_bus_cb (GObject      *source_object,
                               g_task_get_cancellable (task),
                               printer_rename_dbus_cb,
                               task);
+      g_steal_pointer (&task);
     }
   else
     {


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