diff options
author | Max Kellermann <max@duempel.org> | 2008-09-22 10:04:33 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-22 10:04:33 +0200 |
commit | d28a7d463b62412e2d075b834db20baf93dcaeba (patch) | |
tree | ac0692181cd7692a8b509839b8fe65be8bbbdcd4 /src | |
parent | f988e127fa67f9a440b2f3f7ffd4508f2ed7f972 (diff) | |
download | mpd-d28a7d463b62412e2d075b834db20baf93dcaeba.tar.gz mpd-d28a7d463b62412e2d075b834db20baf93dcaeba.tar.xz mpd-d28a7d463b62412e2d075b834db20baf93dcaeba.zip |
main: free keyboard IO channel
Before terminating ncmpc, free the keyboard GIOChannel object.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c index 6f662f53c..5dac8b92b 100644 --- a/src/main.c +++ b/src/main.c @@ -336,6 +336,7 @@ main(int argc, const char *argv[]) { struct sigaction act; const char *charset = NULL; + GIOChannel *keyboard_channel; #ifdef HAVE_LOCALE_H /* time and date formatting */ @@ -431,8 +432,8 @@ main(int argc, const char *argv[]) main_loop = g_main_loop_new(NULL, FALSE); /* watch out for keyboard input */ - g_io_add_watch(g_io_channel_unix_new(STDIN_FILENO), G_IO_IN, - keyboard_event, NULL); + keyboard_channel = g_io_channel_unix_new(STDIN_FILENO); + g_io_add_watch(keyboard_channel, G_IO_IN, keyboard_event, NULL); /* attempt to connect */ reconnect_source_id = g_timeout_add(1, timer_reconnect, NULL); @@ -444,7 +445,11 @@ main(int argc, const char *argv[]) idle_source_id = g_timeout_add(idle_interval, timer_idle, NULL); g_main_loop_run(main_loop); + + /* cleanup */ + g_main_loop_unref(main_loop); + g_io_channel_unref(keyboard_channel); exit_and_cleanup(); } |