Hi,
I am trying to use gtkmozembed in an application that creates and destroys
several windows. See the example code that is attached to this mail. When
running the code the first window with firefox is displayed fine. However,
after destroying the first and creating the second window, I get a
segmentation fault on gtk_widget_show_all(window). This does not happen when
the first window is not destroyed. Am I missing something here?
Thanks,
Richard.
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <gtkmozembed.h>
GtkWidget *window = NULL;
GtkWidget *html = NULL;
gboolean Display(gpointer data) {
/* not sure if gdk_threads_enter is needed,
but it makes no differnece for the crash */
gdk_threads_enter();
if (window) {
printf("gtk_widget_destroy\n");
gtk_widget_destroy(window);
}
printf("gtk_window_new\n");
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
printf("gtk_moz_embed_new\n");
html = gtk_moz_embed_new();
gtk_container_add (GTK_CONTAINER (window), html);
printf("gtk_moz_embed_load_url\n");
gtk_moz_embed_load_url(GTK_MOZ_EMBED(html), "http://www.nu.nl");
printf("gtk_widget_show_all\n");
/* Note: it crashes immediately on this call: */
gtk_widget_show_all(window);
gdk_threads_leave ();
return TRUE;
}
int main(int argc, char** argv) {
g_thread_init(NULL);
gdk_threads_init();
gtk_init(&argc, &argv);
g_timeout_add_seconds(2, Display, NULL);
gtk_main ();
return 0;
}
Makefile:
PKG=gtk+-2.0 firefox-gtkmozembed gthread-2.0
all:
gcc -g moz.c `pkg-config --cflags $(PKG)` `pkg-config --libs $(PKG)` -o
moz
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding