mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-06-18 18:24:51 +02:00
Close the socket event in finalizer instead of in close method
There might be a GSource attached to a GMainContext, about to be removed by a pending cancellation. Deleting the handle too early will trigger a g_warning in the "select()" call in GMainContext. Attached patch fixes this by deferring destruction of WSAEVENT object until GSocket's finalize(). Patch from bug #612702. Signed-off-by: Tor Lillqvist <tml@iki.fi>
This commit is contained in:
parent
6c5d2798f6
commit
1be8ad3514
@ -614,6 +614,12 @@ g_socket_finalize (GObject *object)
|
|||||||
g_socket_close (socket, NULL);
|
g_socket_close (socket, NULL);
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
|
if (socket->priv->event != WSA_INVALID_EVENT)
|
||||||
|
{
|
||||||
|
WSACloseEvent (socket->priv->event);
|
||||||
|
socket->priv->event = WSA_INVALID_EVENT;
|
||||||
|
}
|
||||||
|
|
||||||
g_assert (socket->priv->requested_conditions == NULL);
|
g_assert (socket->priv->requested_conditions == NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2002,14 +2008,6 @@ g_socket_close (GSocket *socket,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
|
||||||
if (socket->priv->event != WSA_INVALID_EVENT)
|
|
||||||
{
|
|
||||||
WSACloseEvent (socket->priv->event);
|
|
||||||
socket->priv->event = WSA_INVALID_EVENT;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
socket->priv->connected = FALSE;
|
socket->priv->connected = FALSE;
|
||||||
socket->priv->closed = TRUE;
|
socket->priv->closed = TRUE;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user