From e5e67c6410fd953f44a414617be9f60253f03a17 Mon Sep 17 00:00:00 2001 From: Kevin Lange Date: Mon, 10 Dec 2012 00:29:04 -0800 Subject: [PATCH] Fix some a quick crash bug --- userspace/game.c | 1 + userspace/lib/decorations.c | 4 +++- userspace/lib/window.c | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/userspace/game.c b/userspace/game.c index 89f3b93d..9bb55c9e 100644 --- a/userspace/game.c +++ b/userspace/game.c @@ -223,6 +223,7 @@ int main(int argc, char ** argv) { window = window_create(10,10, 2 * WINDOW_SIZE, 2 * WINDOW_SIZE); ctx = init_graphics_window_double_buffer(window); draw_fill(ctx,rgb(0,0,0)); + flip(ctx); init_decorations(); focus_changed_callback = focus_callback; diff --git a/userspace/lib/decorations.c b/userspace/lib/decorations.c index 48cc54be..d1fd8707 100644 --- a/userspace/lib/decorations.c +++ b/userspace/lib/decorations.c @@ -68,7 +68,7 @@ void init_decorations() { } -void render_decorations_(window_t * window, gfx_context_t * ctx, char * title, int decors_active) { +static void render_decorations_(window_t * window, gfx_context_t * ctx, char * title, int decors_active) { int width = window->width; int height = window->height; @@ -120,6 +120,7 @@ void render_decorations_(window_t * window, gfx_context_t * ctx, char * title, i } void render_decorations(window_t * window, gfx_context_t * ctx, char * title) { + if (!window) return; if (!window->focused) { render_decorations_(window, ctx, title, INACTIVE); } else { @@ -128,6 +129,7 @@ void render_decorations(window_t * window, gfx_context_t * ctx, char * title) { } void render_decorations_inactive(window_t * window, gfx_context_t * ctx, char * title) { + if (!window) return; render_decorations_(window, ctx, title, INACTIVE); } diff --git a/userspace/lib/window.c b/userspace/lib/window.c index 7806132f..91a21d52 100644 --- a/userspace/lib/window.c +++ b/userspace/lib/window.c @@ -569,11 +569,11 @@ int setup_windowing () { process_windows->windows = list_create(); } - install_signal_handlers(); - event_pipe = syscall_mkpipe(); mouse_event_pipe = syscall_mkpipe(); + install_signal_handlers(); + return wins_connect(); }