The app I am working needs to occasionally show an arbitrary number
of web pages. In the windows port we use that dreaded thing that is
truly an operating system component not a transparent addon to gain
world domination and crush competitors. That allows as to create
browser components on the fly, destroy them when they're not needed,
and later recreate them again.
In the Linux port, I've now got Mozilla to successfully be created
on the fly, but I'm not convinced it's cleaning up after itself when
I destroy the GTK embedding widget. It's not the obvious problem
document on the API pages where after calling NS_TermEmbedding you
cannot call NS_InitEmbedding in the same process. I had this
problem, but then added my own call to gtk_moz_embed_push_startup()
which ensures that NS_TermEmbedding is not called when I destroy
the widget.
What happens now is that after I create an instance of the
embedding widget, then after a while destroy it, I get GTK
warnings, such as:
Gtk-WARNING **: invalid cast from `(unknown)' to `GtkObject'
Gtk-WARNING **: invalid cast from `(unknown)' to `GtkObject'
Gtk-CRITICAL **: file gtksignal.c: line 541 (gtk_signal_emit): assertion
`gtk_type_is_a(GTK_OBJECT_TYPE (object), signal->object_type)' failed.
What appears to be happening is that gtk_mozarea_get_toplevel_focus() is
being called, but since there is no longer any Mozilla widget, GTK's
type casting is going awry. Eventually, since we are presumably somehow
still referring to objects that have been destroyed, this results in a
segmentation fault.
So, is there any further cleanup required apart from just destroying the
GTK embedding widget? Specifically, what is this "mozarea" GTK class, and
why does it keep hanging around (assuming that's what's actually happening).
Cheers,
Bernie