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.
This commit is contained in:
Marek Kasik
2020-10-29 17:14:31 +01:00
committed by Robert Ancell
parent f1bcaf1fbc
commit c18875c623

View File

@@ -152,7 +152,7 @@ printer_rename_dbus_cb (GObject *source_object,
g_autoptr(GVariant) output = NULL; g_autoptr(GVariant) output = NULL;
gboolean result = FALSE; gboolean result = FALSE;
g_autoptr(GError) error = NULL; 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), output = g_dbus_connection_call_finish (G_DBUS_CONNECTION (source_object),
res, res,
@@ -227,6 +227,7 @@ get_bus_cb (GObject *source_object,
g_task_get_cancellable (task), g_task_get_cancellable (task),
printer_rename_dbus_cb, printer_rename_dbus_cb,
task); task);
g_steal_pointer (&task);
} }
else else
{ {