[wing/wip/nacho/poll-stream] Close event handle on finalize



commit eb7f3f0a33bf71291dadb7f10cc951ad324b125f
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date:   Wed Nov 28 16:26:37 2018 +0100

    Close event handle on finalize

 wing/winginputstream.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
---
diff --git a/wing/winginputstream.c b/wing/winginputstream.c
index d3d642d..1b5994a 100644
--- a/wing/winginputstream.c
+++ b/wing/winginputstream.c
@@ -56,6 +56,21 @@ G_DEFINE_TYPE_WITH_CODE (WingInputStream, wing_input_stream, G_TYPE_INPUT_STREAM
                          G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM, 
wing_input_stream_pollable_iface_init)
                          )
 
+static void
+wing_input_stream_finalize (GObject *object)
+{
+  WingInputStream *wing_stream;
+  WingInputStreamPrivate *priv;
+
+  wing_stream = WING_INPUT_STREAM (object);
+  priv = wing_input_stream_get_instance_private (wing_stream);
+
+  if (priv->overlap.hEvent != INVALID_HANDLE_VALUE)
+    CloseHandle (priv->overlap.hEvent);
+
+  G_OBJECT_CLASS (wing_input_stream_parent_class)->finalize (object);
+}
+
 static void
 wing_input_stream_set_property (GObject         *object,
                                 guint            prop_id,
@@ -239,6 +254,7 @@ wing_input_stream_class_init (WingInputStreamClass *klass)
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
 
+  gobject_class->finalize = wing_input_stream_finalize;
   gobject_class->get_property = wing_input_stream_get_property;
   gobject_class->set_property = wing_input_stream_set_property;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]