在以下使用GTK3编译的示例中,当我在输入字段中单击时,GtkExpander会无意中崩溃。
#include <gtk/gtk.h>
static void destroy (GtkWidget *widget, gpointer data)
{
gtk_main_quit ();
}
int main( int argc,
char *argv[] )
{
gtk_init (&argc, &argv);
GtkWidget *entry;
entry = gtk_entry_new ();
GtkWidget *expander;
expander = gtk_expander_new ("test");
gtk_expander_set_expanded (GTK_EXPANDER(expander), TRUE);
gtk_container_add (GTK_CONTAINER(expander), entry);
GtkWidget *window;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_add (GTK_CONTAINER(window), expander);
g_signal_connect (window, "destroy", G_CALLBACK (destroy), NULL);
gtk_widget_show_all (window);
gtk_main ();
return 0;
}
但是,如果GtkExpander在gtk_widget_show_all()
之后展开,那么不会崩溃,即:
gtk_widget_show_all (window);
gtk_expander_set_expanded (GTK_EXPANDER(expander), TRUE);
在gtk_widget_show_all()
之前展开小部件有什么问题?
答案 0 :(得分:0)
这是GTK +中的一个错误,现在已修复。
详见: