From e814f969f41041687a5e1cfce558b64432130279 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Wed, 7 Oct 2009 21:01:37 +0000 Subject: [PATCH] Fixed bug - glk_set_window(NULL) doesn't crash anymore git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@133 ddfedd41-794f-dd11-ae45-00112f111e67 --- libchimara/window.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libchimara/window.c b/libchimara/window.c index 53f264d..7dd14c7 100644 --- a/libchimara/window.c +++ b/libchimara/window.c @@ -895,17 +895,26 @@ glk_window_clear(winid_t win) /** * glk_set_window: - * @win: A window. + * @win: A window, or %NULL. * * Sets the current stream to @win's window stream. It is exactly equivalent to * |[ #glk_stream_set_current(#glk_window_get_stream(@win)) ]| * See Streams. + * + * Chimara + * + * Although this is not mentioned in the specification, @win may also be + * %NULL, in which case the current stream is also set to %NULL. + * */ void glk_set_window(winid_t win) { - VALID_WINDOW(win, return); - glk_stream_set_current( glk_window_get_stream(win) ); + VALID_WINDOW_OR_NULL(win, return); + if(win) + glk_stream_set_current( glk_window_get_stream(win) ); + else + glk_stream_set_current(NULL); } /** -- 2.30.2