我将旧的(纯C)程序转换为Gtk-3,虽然完成了转换,但我必须调试一些问题。调试很困难,因为我一直在努力:
Gtk-WARNING **: Failed to fetch network locations: The specified location is not mounted
这会导致调试器在每次运行中停止(我需要-g-fatal-errors)。
当我在gtk_file_chooser_dialog的实例上调用gtk_dialog_run时,似乎发生了错误。文件名为空。
据我所知,gvfs负责这项工作。如何确定指定的位置'错误信息是指?或者任何其他提出此错误的建议将不胜感激。
这是WARNING位置的回溯:
Thread 1 (Thread 0x7ffff7f7e280 (LWP 15613)):
#0 _g_log_abort (breakpoint=breakpoint@entry=1) at gmessages.c:549
#1 0x00007ffff5844e02 in g_log_writer_default (log_level=<optimized out>, log_level@entry=G_LOG_LEVEL_WARNING, fields=fields@entry=0x7fffffffc480, n_fields=n_fields@entry=6, user_data=user_data@entry=0x0) at gmessages.c:2613
#2 0x00007ffff58434ec in g_log_structured_array (log_level=G_LOG_LEVEL_WARNING, fields=0x7fffffffc480, n_fields=6) at gmessages.c:1933
#3 0x00007ffff5843807 in g_log_structured (log_domain=log_domain@entry=0x7ffff752aad8 "Gtk", log_level=log_level@entry=G_LOG_LEVEL_WARNING) at gmessages.c:1760
#4 0x00007ffff73e70e5 in network_enumeration_finished (source_object=<optimized out>, res=<optimized out>, user_data=0xb90b40) at gtkplacesview.c:1037
#5 0x00007ffff697adb7 in g_simple_async_result_complete (simple=0x11e9550) at gsimpleasyncresult.c:801
#6 0x00007fffed014c71 in ?? () from /usr/lib64/gio/modules/libgvfsdbus.so
#7 0x00007fffed00fd39 in ?? () from /usr/lib64/gio/modules/libgvfsdbus.so
#8 0x00007fffecdf9201 in ?? () from /usr/lib64/libgvfscommon.so.0
#9 0x00007fffefa3c4ca in ?? () from /usr/lib64/libdbus-1.so.3
#10 0x00007fffefa3f69a in dbus_connection_dispatch () from /usr/lib64/libdbus-1.so.3
#11 0x00007fffecdf7b65 in ?? () from /usr/lib64/libgvfscommon.so.0
#12 0x00007ffff583d14d in g_main_dispatch (context=0x6d46e0) at gmain.c:3234
#13 g_main_context_dispatch (context=context@entry=0x6d46e0) at gmain.c:3887
#14 0x00007ffff583d3f8 in g_main_context_iterate (context=0x6d46e0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3960
#15 0x00007ffff583d712 in g_main_loop_run (loop=0x11e01e0) at gmain.c:4156
#16 0x00007ffff730d8d3 in gtk_dialog_run (dialog=0xf7f350) at gtkdialog.c:1397
#17 0x000000000040c20e in run_filedialog (title=0x441130 "Load a circuit", fn=0x441146 ".", openfile=1) at misc.c:224
答案 0 :(得分:0)
该消息来自GLib的Gio模块。确切的位置取决于您使用的Glib的版本。
您的回溯中的 network_enumeration_finished
来自gtk/gtkplacesview.c
:
static void
network_enumeration_finished (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
GtkPlacesViewPrivate *priv;
GFileEnumerator *enumerator;
GError *error;
error = NULL;
enumerator = g_file_enumerate_children_finish (G_FILE (source_object), res, &error);
if (error)
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) &&
!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED))
g_warning ("Failed to fetch network locations: %s", error->message);
g_clear_error (&error);
g_object_unref (GTK_PLACES_VIEW (user_data));
}
else
{
...
}
}
因此g_file_enumerate_children_finish
的调用失败了。该功能位于gio/gfile.c
中的GLib's source。
在g_file_get_uri
上的调试器中调用source_object
应该会为您提供失败位置的URI。