gtkmozembed 段错误
我无法让 gtkmozembed 工作:
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gtkmozembed.h>
#include <stdlib.h>
#include <stdio.h>
static void destroy( GtkWidget *widget,
gpointer data )
{
gtk_main_quit ();
}
int main( int argc,
char *argv[] )
{
GtkWidget *window, *mozwidget;
gtk_init (&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy",
G_CALLBACK (destroy), NULL);
mozwidget=gtk_moz_embed_new();
gtk_moz_embed_load_url (GTK_MOZ_EMBED(mozwidget),"http://www.google.com");
gtk_container_add (GTK_CONTAINER (window), mozwidget);
//last line running correctly
gtk_widget_show_all(window);
//not running anything after this line
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(window),TRUE);
gtk_window_set_type_hint(GTK_WINDOW(window),GDK_WINDOW_TYPE_HINT_DOCK),
gtk_window_set_skip_pager_hint(GTK_WINDOW(window),TRUE);
gtk_window_set_keep_below(GTK_WINDOW(window),TRUE);
gtk_window_set_decorated(GTK_WINDOW(window),FALSE);
gtk_window_stick(GTK_WINDOW(window));
gtk_main ();
return 0;
}
我编译使用:
gcc -g main.c -o xulwidget $(pkg-config --cflags --libs gtk+-2.0) -I /usr/include/xulrunner-2.0 -L /usr/lib/xulrunner-2.0 -lxul
错误:第 30 行周围的分段错误(请参阅上面的注释)
Stacktrace(没有 xul 和 gtk 的调试库):
#0 0x00007ffff3b2fc05 in ?? () from //usr/lib64/xulrunner-2.0/libxul.so
#1 0x00007ffff3b2e706 in ?? () from //usr/lib64/xulrunner-2.0/libxul.so
#2 0x00007ffff58da1ae in g_closure_invoke () from /usr/lib64/libgobject-2.0.so.0
#3 0x00007ffff58efa68 in ?? () from /usr/lib64/libgobject-2.0.so.0
#4 0x00007ffff58f15f4 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
#5 0x00007ffff58f1b73 in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
#6 0x00007ffff7a253a7 in gtk_widget_realize () from /usr/lib64/libgtk-x11-2.0.so.0
#7 0x00007ffff7a25b98 in gtk_widget_map () from /usr/lib64/libgtk-x11-2.0.so.0
#8 0x00007ffff7a3644a in ?? () from /usr/lib64/libgtk-x11-2.0.so.0
#9 0x00007ffff58da1ae in g_closure_invoke () from /usr/lib64/libgobject-2.0.so.0
#10 0x00007ffff58efa68 in ?? () from /usr/lib64/libgobject-2.0.so.0
#11 0x00007ffff58f15f4 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
#12 0x00007ffff58f1b73 in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
#13 0x00007ffff7a25b6e in gtk_widget_map () from /usr/lib64/libgtk-x11-2.0.so.0
#14 0x00007ffff7a36580 in ?? () from /usr/lib64/libgtk-x11-2.0.so.0
#15 0x00007ffff58da1ae in g_closure_invoke () from /usr/lib64/libgobject-2.0.so.0
#16 0x00007ffff58efa68 in ?? () from /usr/lib64/libgobject-2.0.so.0
#17 0x00007ffff58f15f4 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
#18 0x00007ffff58f1b73 in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
#19 0x00007ffff7a262e3 in gtk_widget_show () from /usr/lib64/libgtk-x11-2.0.so.0
#20 0x0000000000400f11 in main (argc=1, argv=0x7fffffffd8f8) at main.c:29
I can't get gtkmozembed to work:
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gtkmozembed.h>
#include <stdlib.h>
#include <stdio.h>
static void destroy( GtkWidget *widget,
gpointer data )
{
gtk_main_quit ();
}
int main( int argc,
char *argv[] )
{
GtkWidget *window, *mozwidget;
gtk_init (&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy",
G_CALLBACK (destroy), NULL);
mozwidget=gtk_moz_embed_new();
gtk_moz_embed_load_url (GTK_MOZ_EMBED(mozwidget),"http://www.google.com");
gtk_container_add (GTK_CONTAINER (window), mozwidget);
//last line running correctly
gtk_widget_show_all(window);
//not running anything after this line
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(window),TRUE);
gtk_window_set_type_hint(GTK_WINDOW(window),GDK_WINDOW_TYPE_HINT_DOCK),
gtk_window_set_skip_pager_hint(GTK_WINDOW(window),TRUE);
gtk_window_set_keep_below(GTK_WINDOW(window),TRUE);
gtk_window_set_decorated(GTK_WINDOW(window),FALSE);
gtk_window_stick(GTK_WINDOW(window));
gtk_main ();
return 0;
}
I compile using:
gcc -g main.c -o xulwidget $(pkg-config --cflags --libs gtk+-2.0) -I /usr/include/xulrunner-2.0 -L /usr/lib/xulrunner-2.0 -lxul
Error: segmentation fault around line 30 (see comments above)
Stacktrace (don't have debug libs for xul and gtk):
#0 0x00007ffff3b2fc05 in ?? () from //usr/lib64/xulrunner-2.0/libxul.so
#1 0x00007ffff3b2e706 in ?? () from //usr/lib64/xulrunner-2.0/libxul.so
#2 0x00007ffff58da1ae in g_closure_invoke () from /usr/lib64/libgobject-2.0.so.0
#3 0x00007ffff58efa68 in ?? () from /usr/lib64/libgobject-2.0.so.0
#4 0x00007ffff58f15f4 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
#5 0x00007ffff58f1b73 in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
#6 0x00007ffff7a253a7 in gtk_widget_realize () from /usr/lib64/libgtk-x11-2.0.so.0
#7 0x00007ffff7a25b98 in gtk_widget_map () from /usr/lib64/libgtk-x11-2.0.so.0
#8 0x00007ffff7a3644a in ?? () from /usr/lib64/libgtk-x11-2.0.so.0
#9 0x00007ffff58da1ae in g_closure_invoke () from /usr/lib64/libgobject-2.0.so.0
#10 0x00007ffff58efa68 in ?? () from /usr/lib64/libgobject-2.0.so.0
#11 0x00007ffff58f15f4 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
#12 0x00007ffff58f1b73 in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
#13 0x00007ffff7a25b6e in gtk_widget_map () from /usr/lib64/libgtk-x11-2.0.so.0
#14 0x00007ffff7a36580 in ?? () from /usr/lib64/libgtk-x11-2.0.so.0
#15 0x00007ffff58da1ae in g_closure_invoke () from /usr/lib64/libgobject-2.0.so.0
#16 0x00007ffff58efa68 in ?? () from /usr/lib64/libgobject-2.0.so.0
#17 0x00007ffff58f15f4 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
#18 0x00007ffff58f1b73 in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
#19 0x00007ffff7a262e3 in gtk_widget_show () from /usr/lib64/libgtk-x11-2.0.so.0
#20 0x0000000000400f11 in main (argc=1, argv=0x7fffffffd8f8) at main.c:29
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Mozilla 从 4.0 开始就不再是嵌入式的了。
不要尝试,使用 GtkWebkit,如果您在 Windows/MacOSX 上需要它,请踢维护人员的屁股,因为他们不应该如此依赖于单一平台。
Mozilla is not embeddable anymore since 4.0.
Don't try it, use GtkWebkit and if you need it on Windows/MacOSX kick the ass of the maintainers that they should not be so single platform dependent.