'How to add a horizontal separator to a gtk tool palette?

I know that tool palettes can't have widgets added to them directly, only tool item groups. I have a group with all the buttons I want and its added and everything is good. Then, I wanted to add a separator. I did it this way:

//make a tool palette called tool_palette and add a button before and
//after this separator
   Gtk::ToolItemGroup *tool_item_group = Gtk::manage(new Gtk::ToolItemGroup());   //to make the tool item group
   gtk_tool_item_group_set_label(tool_item_group->gobj(), nullptr); 

Gtk::SeparatorToolItem *seperator = Gtk::manage(new Gtk::SeparatorToolItem());
   seperator->show();
   tool_item_group->insert(*seperator);
tool_palette.add(*tool_item_group);
   tool_palette.set_sensitive(true);

The problem here is that the separator ends up looking like this:

p

also it runs with the error:

Gtk-CRITICAL **: 03:20:29.865: gtk_widget_set_focus_on_click: assertion 'GTK_IS_WIDGET (widget)' failed


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source