gsocketlistener: set source object tag before completing the GTask
authorAleksander Morgado <aleksander@lanedo.com>
Mon, 3 Dec 2012 14:59:06 +0000 (15:59 +0100)
committerAleksander Morgado <aleksander@lanedo.com>
Mon, 3 Dec 2012 14:59:06 +0000 (15:59 +0100)
Otherwise, the finish() method won't find the source object.

https://bugzilla.gnome.org/show_bug.cgi?id=689538

gio/gsocketlistener.c

index f6aba24..7af0d14 100644 (file)
@@ -694,12 +694,12 @@ accept_ready (GSocket      *accept_socket,
   socket = g_socket_accept (accept_socket, g_task_get_cancellable (task), &error);
   if (socket)
     {
-      g_task_return_pointer (task, socket, g_object_unref);
       source_object = g_object_get_qdata (G_OBJECT (accept_socket), source_quark);
       if (source_object)
        g_object_set_qdata_full (G_OBJECT (task),
                                 source_quark,
                                 g_object_ref (source_object), g_object_unref);
+      g_task_return_pointer (task, socket, g_object_unref);
     }
   else
     {