Fix a write to freed memory: Unlock the channel's mutex before unrefing
[platform/upstream/glib.git] / glib / giowin32.c
index 9bffc05..72fe44e 100644 (file)
@@ -737,8 +737,8 @@ g_io_win32_finalize (GSource *source)
     send (channel->reset_send, send_buffer, sizeof (send_buffer), 0);
   }
 
-  g_io_channel_unref (watch->channel);
   UNLOCK (channel->mutex);
+  g_io_channel_unref (watch->channel);
 }
 
 GSourceFuncs g_io_watch_funcs = {