diff options
author | Max Kellermann <max@duempel.org> | 2009-01-10 18:55:36 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-10 18:55:36 +0100 |
commit | e3c6ad515d80266636b09d794b3db98fc0e684ee (patch) | |
tree | 0472ab7ef75a4d73ee401f58a5fb4b512abeb748 | |
parent | ca5432a79b6fe16a9e14dfbd0d3880d9c60eac73 (diff) | |
download | mpd-e3c6ad515d80266636b09d794b3db98fc0e684ee.tar.gz mpd-e3c6ad515d80266636b09d794b3db98fc0e684ee.tar.xz mpd-e3c6ad515d80266636b09d794b3db98fc0e684ee.zip |
event_pipe: remove the GLib source from the main context
Free memory before exiting.
Diffstat (limited to '')
-rw-r--r-- | src/event_pipe.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/event_pipe.c b/src/event_pipe.c index f870a187a..2bfdf2044 100644 --- a/src/event_pipe.c +++ b/src/event_pipe.c @@ -35,6 +35,7 @@ #endif static int event_pipe[2]; +static guint event_pipe_source_id; static GMutex *event_pipe_mutex; static bool pipe_events[PIPE_EVENT_MAX]; static event_pipe_callback_t event_pipe_callbacks[PIPE_EVENT_MAX]; @@ -92,7 +93,8 @@ void event_pipe_init(void) g_error("Couldn't set non-blocking I/O: %s", strerror(errno)); channel = g_io_channel_unix_new(event_pipe[0]); - g_io_add_watch(channel, G_IO_IN, main_notify_event, NULL); + event_pipe_source_id = g_io_add_watch(channel, G_IO_IN, + main_notify_event, NULL); g_io_channel_unref(channel); event_pipe_mutex = g_mutex_new(); @@ -102,6 +104,8 @@ void event_pipe_deinit(void) { g_mutex_free(event_pipe_mutex); + g_source_remove(event_pipe_source_id); + close(event_pipe[0]); close(event_pipe[1]); } |