Menu throws a critical message when closing app

In closing the attached application, using the menu path: Client | Quit, I get the critical message

Gtk-CRITICAL **: gtk_tristate_accessible_value_get: assertion ‘value->value_class == &GTK_TRISTATE_ACCESSIBLE_VALUE’ failed

#include <gtkmm.h>

class Window
:
	public Gtk::Window
{
public:

	Window()
	:
		vbox (Gtk::Orientation::VERTICAL, 0),
	
		refBuilder (Gtk::Builder::create()),
		refSimpleActionGroup (Gio::SimpleActionGroup::create())
	{
		set_title ("Hello");
		
		set_default_size (200, 200);
		
		refSimpleActionGroup->add_action_bool ("done");

		refSimpleActionGroup->add_action ("quit", 
			sigc::mem_fun (*this, &Gtk::Widget::hide));
	
		insert_action_group ("menu", refSimpleActionGroup);
	
		try
		{
			refBuilder->add_from_string (get_menu_info());
		}
		catch (...)
		{}
	
		Glib::RefPtr<Gio::Menu> gmenu = 
			std::dynamic_pointer_cast<Gio::Menu> (refBuilder->get_object ("menubar"));

		if (gmenu)
		{
			auto menubar = Gtk::make_managed<Gtk::PopoverMenuBar>(gmenu);
			menubar->set_margin (5);

			vbox.append (*menubar);
		}

		set_child (vbox);
	}

private:

	Glib::ustring get_menu_info() const
	{
		return
			"<interface>"
			"  <menu id='menubar'>"
			"    <submenu>"
			"      <attribute name='label' translatable='yes'>Client</attribute>"
			"      <section>"
			"        <item>"
			"          <attribute name='label' translatable='yes'>Done</attribute>"
			"          <attribute name='action'>menu.done</attribute>"
			"        </item>"
			"      </section>"
			"      <section>"
			"        <item>"
			"          <attribute name='label' translatable='yes'>Quit</attribute>"
			"          <attribute name='action'>menu.quit</attribute>"
			"        </item>"
			"      </section>"
			"    </submenu>"
			"  </menu>"
			"</interface>";
	}
	
	Gtk::Box vbox;
	
	Glib::RefPtr<Gtk::Builder> refBuilder;
	Glib::RefPtr<Gio::SimpleActionGroup> refSimpleActionGroup;
};

int main (int argc, char *argv[])
{
	Glib::RefPtr<Gtk::Application> app = Gtk::Application::create ("org.hello");
	return app->make_window_and_run<Window>(argc, argv);
}

What I’m doing wrong ?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.