Instantiating/uninstatiating Gtk::Main leaves the system in a different state, makes further UI operations break
Submitted by Yuri
Link to original bug (#787595)
Description
I need to instantiate Gtkmm UI in the middle of the non-gtk process, and be able to do it and undo it cleanly many times.
It works when I instantiate it once, like this:
static int argc = 1; static char* xargv[1] = {"x"}; static char** argv = xargv; gtkmmMain = new Gtk::Main(&argc, &argv); ... code creating gtk widgets follows here ... works fine
However, widget creation fails after Gtk::Main has been created, destroyed, and then created again:
static int argc = 1; static char* xargv[1] = {"x"}; static char** argv = xargv; gtkmmMain = new Gtk::Main(&argc, &argv); gtkmmMain->quit(); delete gtkmmMain; gtkmmMain = new Gtk::Main(&argc, &argv); ... widget creation now fails: (x:38888): glibmm-CRITICAL **: Glib::ObjectBase > *Glib::wrap_create_new_wrapper(GObject *): assertion 'wrap_func_table != nullptr' failed
(x:38888): glibmm-WARNING **: Failed to wrap object of type 'GdkPixbuf'. Hint: this error is commonly caused by failing to call a library init() function. Segmentation fault
It should be possible to instantiate, delete the Gtkmm::Main object, and then re-instantiate it again, and so on.
Version: 2.24.x