From 7ae0c170ad2f63ac7e27d0496cd9c167e2bd0cbd Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sat, 20 Feb 2010 17:40:07 +0000 Subject: Added Fl_Widget_Tracker in handle() methods etc. to avoid accessing widgets after deletion (STR #1306). This is all I could find, but maybe there are more places in the code. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7115 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Input_Choice.H | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'FL/Fl_Input_Choice.H') diff --git a/FL/Fl_Input_Choice.H b/FL/Fl_Input_Choice.H index a5d025523..0010ea336 100644 --- a/FL/Fl_Input_Choice.H +++ b/FL/Fl_Input_Choice.H @@ -76,6 +76,7 @@ class Fl_Input_Choice : public Fl_Group { static void menu_cb(Fl_Widget*, void *data) { Fl_Input_Choice *o=(Fl_Input_Choice *)data; + Fl_Widget_Tracker wp(o); const Fl_Menu_Item *item = o->menubutton()->mvalue(); if (item && item->flags & (FL_SUBMENU|FL_SUBMENU_POINTER)) return; // ignore submenus if (!strcmp(o->inp_->value(), o->menu_->text())) @@ -92,6 +93,8 @@ class Fl_Input_Choice : public Fl_Group { if (o->when() & (FL_WHEN_CHANGED|FL_WHEN_RELEASE)) o->do_callback(); } + + if (wp.deleted()) return; if (o->callback() != default_callback) { @@ -102,6 +105,7 @@ class Fl_Input_Choice : public Fl_Group { static void inp_cb(Fl_Widget*, void *data) { Fl_Input_Choice *o=(Fl_Input_Choice *)data; + Fl_Widget_Tracker wp(o); if (o->inp_->changed()) { o->Fl_Widget::set_changed(); if (o->when() & (FL_WHEN_CHANGED|FL_WHEN_RELEASE)) @@ -111,6 +115,8 @@ class Fl_Input_Choice : public Fl_Group { if (o->when() & FL_WHEN_NOT_CHANGED) o->do_callback(); } + + if (wp.deleted()) return; if (o->callback() != default_callback) o->Fl_Widget::clear_changed(); -- cgit v1.2.3