From: Philip Chimento Date: Wed, 24 Dec 2008 22:14:03 +0000 (+0000) Subject: Fixed a segfault when opening an invalid window. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=82f6ec09bd0e781f3be62853da77ce4c334bf0e4;p=rodin%2Fchimara.git Fixed a segfault when opening an invalid window. git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@17 ddfedd41-794f-dd11-ae45-00112f111e67 --- diff --git a/src/Makefile.am b/src/Makefile.am index ee0385c..488abd5 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -39,7 +39,7 @@ libchimara_la_LDFLAGS = -no-undefined -export-symbols-regex "^chimara_glk_.*|^gl libchimara_includedir = $(includedir)/chimara/chimara libchimara_include_HEADERS = chimara-glk.h -pkglib_LTLIBRARIES = first.la model.la +pkglib_LTLIBRARIES = first.la model.la gridtest.la first_la_SOURCES = first.c first_la_LIBADD = libchimara.la @@ -49,6 +49,10 @@ model_la_SOURCES = model.c model_la_LIBADD = libchimara.la model_la_LDFLAGS = -module -avoid-version +gridtest_la_SOURCES = gridtest.c +gridtest_la_LIBADD = libchimara.la +gridtest_la_LDFLAGS = -module -avoid-version + CLEANFILES = chimara.ui chimara.ui: chimara.glade diff --git a/src/gridtest.c b/src/gridtest.c new file mode 100644 index 0000000..1f81736 --- /dev/null +++ b/src/gridtest.c @@ -0,0 +1,12 @@ +#include "glk.h" + +void glk_main(void) +{ + winid_t mainwin = glk_window_open(0, 0, 0, wintype_TextGrid, 0); + if(!mainwin) + return; + + glk_set_window(mainwin); + glk_put_string("Philip en Marijn zijn vet goed.\n"); + glk_put_string("A veeeeeeeeeeeeeeeeeeeeeeeeeeeery looooooooooooooooooooooooong striiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiing\n"); +} \ No newline at end of file diff --git a/src/main.c b/src/main.c index 324e49e..fd2700d 100644 --- a/src/main.c +++ b/src/main.c @@ -115,7 +115,7 @@ main(int argc, char *argv[]) g_object_unref( G_OBJECT(builder) ); - if( !chimara_glk_run(CHIMARA_GLK(glk), ".libs/first.so", &error) ) { + if( !chimara_glk_run(CHIMARA_GLK(glk), ".libs/gridtest.so", &error) ) { error_dialog(GTK_WINDOW(window), error, "Error starting Glk library: "); return 1; } diff --git a/src/window.c b/src/window.c index 16927ca..5b6b621 100644 --- a/src/window.c +++ b/src/window.c @@ -243,6 +243,8 @@ glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype, gdk_threads_leave(); g_warning("%s: unsupported window type", __func__); g_free(win); + g_node_destroy(glk_data->root_window); + glk_data->root_window = NULL; return NULL; }