destroying a widget after exit from main()
- From: Havoc Pennington <rhp zirx pair com>
- To: gtk-list redhat com
- Subject: destroying a widget after exit from main()
- Date: Fri, 19 Mar 1999 18:52:16 -0500 (EST)
Hi,
The attached program segfaults when destroying a GtkEntry in the
destructor for a static object. I'm not sure if this is supposed to work
or not though...
This is GTK_1_2_0 from CVS.
Thanks,
Havoc
#include <gtk/gtk.h>
class Whatever {
public:
~Whatever() {
gtk_widget_destroy(widget);
}
GtkWidget* widget;
};
Whatever what;
gint
quit_cb(GtkWidget* w, GdkEventAny* de, gpointer data)
{
gtk_main_quit();
return TRUE;
}
int main(int argc, char** argv)
{
GtkWidget* entry;
gtk_init(&argc, &argv);
what.widget = gtk_window_new(GTK_WINDOW_DIALOG);
entry = gtk_entry_new();
gtk_container_add(GTK_CONTAINER(what.widget), entry);
gtk_signal_connect(GTK_OBJECT(what.widget), "delete_event",
GTK_SIGNAL_FUNC(quit_cb), NULL);
gtk_widget_show_all(what.widget);
gtk_main();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]