The first example I did to verify this problem is equal to the "simple" example that comes with the gtkmozembedmm sources, with the only difference that it's in loop and the Simple class object is declared as a pointer to be able to build it and destroy it for each iteration. I confirmed it dumps unexpectedly, maybe because I'm not using the mozilla webcontrol correctly...??? The second example is equal to the first but with a button instead of a webcontrol, but as I hoped in this case it doesn't fail.
I'm attaching both examples and a makefile so you can verify this too.The reason of doing this tests is because I need to open and close more than once (here is the problem) a window on my application containing a webcontrol, and to be able to free the memory each time it is closed, but the next time I open the window and the class constructor is called, occurs a segmentation fault like in the first example.
Thanks in advance Cesar
Attachment:
Makefile
Description: Binary data
#include <gtkmm.h> #include <gtkmozembedmm.h> const Glib::ustring test_uri = "file:///usr/share/gtk-doc/html/gtk/index.html"; class Simple : public Gtk::Window { Gtk::Button b; public: Simple() { set_border_width(5); set_default_size(600, 400); set_title("Simple"); add(b); b.show(); b.set_label(test_uri); } }; int main (int argc, char** argv) { Gtk::Main kit(argc, argv); while (true) { Simple * simple = new Simple(); Gtk::Main::run(*simple); delete simple; } return 0; }
#include <gtkmm.h> #include <gtkmozembedmm.h> const Glib::ustring test_uri = "file:///usr/share/gtk-doc/html/gtk/index.html"; class Simple : public Gtk::Window { Mozilla::WebControl wc; public: Simple() { set_border_width(5); set_default_size(600, 400); set_title("Simple"); add(wc); wc.show(); wc.load_url(test_uri); } }; int main (int argc, char** argv) { Gtk::Main kit(argc, argv); while (true) { Simple * simple = new Simple(); Gtk::Main::run(*simple); delete simple; } return 0; }