Mark, I'm not sure what in your #include "common.h", but I placed the following in mine
#include <stdlib.h> /* for abort() */ #include <gtk/gtk.h> /* for gtk, gdk, and glib */ With that single change the program compiled and executed without error message; as I would have expected. James, On Tue, 2008-02-26 at 01:29 -0500, Mark Rodriguez wrote: > Was wondering if anybody has any idea(s) why the code below would seem > to work fine on GTK/X11 (at least I don't see any error messages), but > fail on GTK/DirectFB? When the application is exited by hitting the > "Quit" button, I receive the following error message: > > *** glibc detected *** TextDemo: double free or corruption (out): 0x4035b1b0 > *** > > I'm trying to figure out if this is a GTK related problem (i.e., am > I'm doing something wrong in GTK) or a problem with GTK/DirectFB. I > have to assume that my code IS the problem, but I just don't see where > / how. Thanks in advance for any suggestions or help. > > [code] > #include "common.h" > > GtkWidget* main_window; > > static gboolean destroy_event(GtkWidget* widget, void* data) > { > gtk_main_quit(); > return FALSE; > } > > static void button_click_event(void) > { > gtk_widget_destroy(main_window); > } > > int main(int argc, char* argv[]) > { > GtkWidget *text_view, *box, *button; > > // initialize multi-threading within GLib > g_thread_init(NULL); > > // initialize multi-threading within GDK > gdk_threads_init(); > > // acquire thread lock > gdk_threads_enter(); > gtk_init(&argc, &argv); > > // create main window > main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); > if (main_window == NULL) > abort(); > g_signal_connect(G_OBJECT(main_window), "destroy", > G_CALLBACK(destroy_event), NULL); > gtk_widget_show(main_window); > > box = gtk_vbox_new(FALSE, 5); > if (box == NULL) > abort(); > gtk_widget_show(box); > gtk_container_add(GTK_CONTAINER(main_window), box); > > text_view = gtk_text_view_new(); > if (text_view == NULL) > abort(); > gtk_widget_show(text_view); > gtk_box_pack_start(GTK_BOX(box), text_view, TRUE, TRUE, 5); > > button = gtk_button_new_with_label("Quit"); > if (button == NULL) > abort(); > g_signal_connect(G_OBJECT(button), "clicked", > G_CALLBACK(button_click_event), NULL); > gtk_widget_show(button); > gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 5); > > // run the main loop > gtk_main(); > > // release thread lock > gdk_threads_leave(); > > return 0; > } > [/code] > > -- > Mark > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list