From ccb70ebe4346d3b3fa9205c4a31a8b1b6872ecf0 Mon Sep 17 00:00:00 2001 From: "P. F. Chimento" Date: Sat, 13 Nov 2010 01:07:17 +0100 Subject: [PATCH] Fixed example program in documentation The example program in ChimaraGlk's documentation had a bug in it. --- libchimara/chimara-glk.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libchimara/chimara-glk.c b/libchimara/chimara-glk.c index 497f862..bbdb614 100644 --- a/libchimara/chimara-glk.c +++ b/libchimara/chimara-glk.c @@ -71,13 +71,6 @@ * #include * #include * - * static gboolean - * quit(void) - * { - * gtk_main_quit(); - * return TRUE; - * } - * * int * main(int argc, char *argv[]) * { @@ -94,10 +87,15 @@ * /* Construct the window and its contents. We quit the GTK main loop * * when the window's close button is clicked. */ * window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - * g_signal_connect(window, "delete-event", G_CALLBACK(quit), NULL); + * g_signal_connect(window, "delete-event", G_CALLBACK(gtk_main_quit), NULL); * glk = chimara_glk_new(); * gtk_container_add(GTK_CONTAINER(window), glk); * gtk_widget_show_all(window); + * + * /* Add a reference to the ChimaraGlk widget, since we want it to + * * persist after the window's delete-event -- otherwise it will be destroyed + * * with the window. */ + * g_object_ref(glk); * * /* Start the Glk program in a separate thread */ * if(!chimara_glk_run(CHIMARA_GLK(glk), "./plugin.so", 2, plugin_argv, &error)) @@ -112,6 +110,7 @@ * * it is still running, and wait for it to exit. */ * chimara_glk_stop(CHIMARA_GLK(glk)); * chimara_glk_wait(CHIMARA_GLK(glk)); + * g_object_unref(glk); * * return 0; * } -- 2.30.2