- 论坛徽章:
- 0
|
这段代码啥问题。只能打印here 1 就seg fault 了。段错在gtk_dialog_run.
新建一个测试工程测试这几行代码是没问题的。有没可能是堆用完了?这种问题怎么调试
{
printf("here 1\n" ;
GtkWidget *w = gtk_file_chooser_dialog_new( "aa", NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_OK, GTK_RESPONSE_OK,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NULL);
if ( gtk_dialog_run( GTK_DIALOG( w ) ) == GTK_RESPONSE_OK ){
printf("here 2\n" ;
}
printf("here 3\n" ;
return;
}
core file dump:
Program terminated with signal 11, Segmentation fault.
#0 0xb5c05100 in g_slice_alloc () from /usr/lib/libglib-2.0.so.0
(gdb) bt
#0 0xb5c05100 in g_slice_alloc () from /usr/lib/libglib-2.0.so.0
#1 0xb5c056e5 in g_slice_alloc0 () from /usr/lib/libglib-2.0.so.0
#2 0xb5ca2ed7 in g_type_create_instance () from /usr/lib/libgobject-2.0.so.0
#3 0xb5c88242 in ?? () from /usr/lib/libgobject-2.0.so.0
#4 0xb5c88a08 in g_object_newv () from /usr/lib/libgobject-2.0.so.0
#5 0xb5c89561 in g_object_new_valist () from /usr/lib/libgobject-2.0.so.0
#6 0xb5c896d0 in g_object_new () from /usr/lib/libgobject-2.0.so.0
#7 0xb60808e7 in gtk_tree_view_new () from /usr/lib/libgtk-x11-2.0.so.0
#8 0xb5f08187 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#9 0xb5ca329e in g_type_create_instance () from /usr/lib/libgobject-2.0.so.0
#10 0xb5c88242 in ?? () from /usr/lib/libgobject-2.0.so.0
......
#58 0x08091720 in tunnel_set_cb (dummy=0x8b56000, user_data=0x0) at main.c:5124 <-- 这里是 gtk_dialog_run的位置
......
#94 0x0808c514 in main (argc=0, argv=0xbf824d5 at main.c:2908
(gdb) |
|