mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 10:42:11 +01:00
Merge branch 'backport-2808-socket-cancellable-glib-2-72' into 'glib-2-72'
Backport !2808 “gsocketclient: Fix passing NULL to g_task_get_cancellable()” to glib-2-72 See merge request GNOME/glib!2810
This commit is contained in:
commit
f8b7a0e802
@ -1508,6 +1508,7 @@ typedef struct
|
|||||||
GSocketClientAsyncConnectData *data; /* unowned */
|
GSocketClientAsyncConnectData *data; /* unowned */
|
||||||
GSource *timeout_source;
|
GSource *timeout_source;
|
||||||
GCancellable *cancellable;
|
GCancellable *cancellable;
|
||||||
|
GCancellable *task_cancellable; /* (owned); this is equal to g_task_get_cancellable (ConnectionAttempt.data->task), but with a longer lifetime */
|
||||||
gulong cancelled_id;
|
gulong cancelled_id;
|
||||||
grefcount ref;
|
grefcount ref;
|
||||||
} ConnectionAttempt;
|
} ConnectionAttempt;
|
||||||
@ -1536,7 +1537,8 @@ connection_attempt_unref (gpointer pointer)
|
|||||||
g_clear_object (&attempt->address);
|
g_clear_object (&attempt->address);
|
||||||
g_clear_object (&attempt->socket);
|
g_clear_object (&attempt->socket);
|
||||||
g_clear_object (&attempt->connection);
|
g_clear_object (&attempt->connection);
|
||||||
g_cancellable_disconnect (g_task_get_cancellable (attempt->data->task), attempt->cancelled_id);
|
g_cancellable_disconnect (attempt->task_cancellable, attempt->cancelled_id);
|
||||||
|
g_clear_object (&attempt->task_cancellable);
|
||||||
attempt->cancelled_id = 0;
|
attempt->cancelled_id = 0;
|
||||||
g_clear_object (&attempt->cancellable);
|
g_clear_object (&attempt->cancellable);
|
||||||
g_clear_object (&attempt->proxy_addr);
|
g_clear_object (&attempt->proxy_addr);
|
||||||
@ -2031,9 +2033,12 @@ g_socket_client_enumerator_callback (GObject *object,
|
|||||||
data->connection_attempts = g_slist_append (data->connection_attempts, attempt);
|
data->connection_attempts = g_slist_append (data->connection_attempts, attempt);
|
||||||
|
|
||||||
if (g_task_get_cancellable (data->task))
|
if (g_task_get_cancellable (data->task))
|
||||||
attempt->cancelled_id =
|
{
|
||||||
g_cancellable_connect (g_task_get_cancellable (data->task), G_CALLBACK (on_connection_cancelled),
|
attempt->task_cancellable = g_object_ref (g_task_get_cancellable (data->task));
|
||||||
g_object_ref (attempt->cancellable), g_object_unref);
|
attempt->cancelled_id =
|
||||||
|
g_cancellable_connect (attempt->task_cancellable, G_CALLBACK (on_connection_cancelled),
|
||||||
|
g_object_ref (attempt->cancellable), g_object_unref);
|
||||||
|
}
|
||||||
|
|
||||||
g_socket_connection_set_cached_remote_address ((GSocketConnection *)attempt->connection, address);
|
g_socket_connection_set_cached_remote_address ((GSocketConnection *)attempt->connection, address);
|
||||||
g_debug ("GSocketClient: Starting TCP connection attempt");
|
g_debug ("GSocketClient: Starting TCP connection attempt");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user