Fixed a segfault when opening an invalid window.
authorPhilip Chimento <philip.chimento@gmail.com>
Wed, 24 Dec 2008 22:14:03 +0000 (22:14 +0000)
committerPhilip Chimento <philip.chimento@gmail.com>
Wed, 24 Dec 2008 22:14:03 +0000 (22:14 +0000)
git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@17 ddfedd41-794f-dd11-ae45-00112f111e67

src/Makefile.am
src/gridtest.c [new file with mode: 0644]
src/main.c
src/window.c

index ee0385c26fa9bf01dd179951a54a1e0fda3ac14d..488abd5f367469347931d2aaaadd28aaed173c2c 100755 (executable)
@@ -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 (file)
index 0000000..1f81736
--- /dev/null
@@ -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
index 324e49e1a2201bf692e15ca617402c096a250843..fd2700d48651379122af5d4aaa3e4e226c935f3d 100644 (file)
@@ -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;
     }
index 16927ca9fd0ee2944748a7b4a58ead4d3502d71e..5b6b62118db5d3671d5a865de4c658ae299be002 100644 (file)
@@ -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;
        }