[gtkmm] Removing a widget from a container temporarily



Hello,

I am trying to remove a Gtk::Viewport widget from a Gtk::HPaned to add
it to a Gtk::Table later:

------------------
hpaned->remove(*viewport1);
hpaned->remove(*viewport2);
table->remove(*hpaned);
table->attach(*viewport1, 0, 1, 0, 1, Gtk::FILL, Gtk::FILL, 0, 0);
------------------

This segfaults at "table->attach":

------------------
#0  0x4047c4e0 in gtk_table_attach () from /usr/lib/libgtk-x11-2.0.so.0
#1  0x40187913 in Gtk::Table::attach(Gtk::Widget&, unsigned, unsigned, unsigned, unsigned, Gtk::AttachOptions, Gtk::AttachOptions, unsigned, unsigned) () from /usr/lib/libgtkmm-2.0.so.1
------------------

>From the gtkmm documentations:

------------------
void Gtk::Container::remove (Widget& widget)

Removes widget from container.

widget must be inside container. Note that container will own a
reference to widget, and that this may be the last reference held; so
removing a widget from its container can destroy that widget. If you
want to use widget again, you need to add a reference to it while it's
not inside a container, using Glib::object_ref().
[...]
------------------

But according to the Glib documentation there is no public function
"object_ref" in the Glib namespace.
I have been looking for a function to do this for almost two hours and
I'm quite close to going insane now. ;)

Any help would be greatly appreciated.

Thanks,
-Samuel



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]