summaryrefslogtreecommitdiff
path: root/libs/gtkmm2ext
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-12-21 17:10:37 +0100
committerRobin Gareus <robin@gareus.org>2016-12-21 17:10:37 +0100
commitde04da27eef9080783ac3519a555ec2c277d548d (patch)
tree437a9379e9d3c8f1abc01949913ff7f66196cab7 /libs/gtkmm2ext
parent98c0adda49ac4245e71adeea144abdb35b10c469 (diff)
Fix crash when unpacking or deleting pane
Gtk::Widget_Class::dispose_vfunc_callback calls hide() which invokes Pane::handle_child_visibility which calls Pane::reallocate which tries to get the allocation of the widget being destroyed.
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/pane.h2
-rw-r--r--libs/gtkmm2ext/pane.cc11
2 files changed, 11 insertions, 2 deletions
diff --git a/libs/gtkmm2ext/gtkmm2ext/pane.h b/libs/gtkmm2ext/gtkmm2ext/pane.h
index 9612da08d2..76eae09dd4 100644
--- a/libs/gtkmm2ext/gtkmm2ext/pane.h
+++ b/libs/gtkmm2ext/gtkmm2ext/pane.h
@@ -49,6 +49,8 @@ class LIBGTKMM2EXT_API Pane : public Gtk::Container
Pane* pane;
Gtk::Widget* w;
int32_t minsize;
+ sigc::connection show_con;
+ sigc::connection hide_con;
Child (Pane* p, Gtk::Widget* widget, uint32_t ms) : pane (p), w (widget), minsize (ms) {}
};
diff --git a/libs/gtkmm2ext/pane.cc b/libs/gtkmm2ext/pane.cc
index be1f63c485..60a6dc543c 100644
--- a/libs/gtkmm2ext/pane.cc
+++ b/libs/gtkmm2ext/pane.cc
@@ -48,6 +48,8 @@ Pane::Pane (bool h)
Pane::~Pane ()
{
for (Children::iterator c = children.begin(); c != children.end(); ++c) {
+ c->show_con.disconnect ();
+ c->hide_con.disconnect ();
c->w->remove_destroy_notify_callback (&(*c));
c->w->unparent ();
}
@@ -142,6 +144,7 @@ void
Pane::on_add (Widget* w)
{
children.push_back (Child (this, w, 0));
+ Child& kid = children.back ();
w->set_parent (*this);
/* Gtkmm 2.4 does not correctly arrange for ::on_remove() to be called
@@ -150,8 +153,8 @@ Pane::on_add (Widget* w)
*/
w->add_destroy_notify_callback (&children.back(), &Pane::notify_child_destroyed);
- w->signal_show().connect (sigc::mem_fun (*this, &Pane::handle_child_visibility));
- w->signal_hide().connect (sigc::mem_fun (*this, &Pane::handle_child_visibility));
+ kid.show_con = w->signal_show().connect (sigc::mem_fun (*this, &Pane::handle_child_visibility));
+ kid.hide_con = w->signal_hide().connect (sigc::mem_fun (*this, &Pane::handle_child_visibility));
while (dividers.size() < (children.size() - 1)) {
add_divider ();
@@ -170,6 +173,8 @@ Pane::child_destroyed (Gtk::Widget* w)
{
for (Children::iterator c = children.begin(); c != children.end(); ++c) {
if (c->w == w) {
+ c->show_con.disconnect ();
+ c->hide_con.disconnect ();
children.erase (c);
break;
}
@@ -182,6 +187,8 @@ Pane::on_remove (Widget* w)
{
for (Children::iterator c = children.begin(); c != children.end(); ++c) {
if (c->w == w) {
+ c->show_con.disconnect ();
+ c->hide_con.disconnect ();
w->remove_destroy_notify_callback (&(*c));
w->unparent ();
children.erase (c);