[gnio] Track closed state of GSocket
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnio] Track closed state of GSocket
- Date: Mon, 27 Apr 2009 11:04:50 -0400 (EDT)
commit b5c628bb8d18ce10df4ea46f73521c04201cbfd3
Author: Alexander Larsson <alexl redhat com>
Date: Mon Apr 27 16:29:32 2009 +0200
Track closed state of GSocket
---
gio/gsocket.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/gio/gsocket.c b/gio/gsocket.c
index ac8b4b8..6bca820 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -72,6 +72,7 @@ struct _GSocketPrivate
GError *error;
GSocketAddress *local_address;
GSocketAddress *remote_address;
+ gboolean closed;
};
static void
@@ -340,7 +341,8 @@ g_socket_finalize (GObject *object)
g_clear_error (&socket->priv->error);
- g_socket_close (socket);
+ if (!socket->priv->closed)
+ g_socket_close (socket);
if (G_OBJECT_CLASS (g_socket_parent_class)->finalize)
(*G_OBJECT_CLASS (g_socket_parent_class)->finalize) (object);
@@ -765,11 +767,16 @@ g_socket_close (GSocket *socket)
{
g_return_if_fail (G_IS_SOCKET (socket));
+ if (socket->priv->closed)
+ return;
+
#ifdef G_OS_WIN32
closesocket (socket->priv->fd);
#else
close (socket->priv->fd);
#endif
+
+ socket->priv->closed = TRUE;
}
GSource *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]