diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2010-02-20 17:40:07 +0000 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2010-02-20 17:40:07 +0000 |
| commit | 7ae0c170ad2f63ac7e27d0496cd9c167e2bd0cbd (patch) | |
| tree | 0d51f2e36cc11714c6ee5923f8d52c6a9a3793dc /src/Fl_Button.cxx | |
| parent | c7a1aead4c9b79882b64267b492b1f9d87ab22d0 (diff) | |
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
Diffstat (limited to 'src/Fl_Button.cxx')
| -rw-r--r-- | src/Fl_Button.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Fl_Button.cxx b/src/Fl_Button.cxx index c32075999..147e5cf4d 100644 --- a/src/Fl_Button.cxx +++ b/src/Fl_Button.cxx @@ -117,7 +117,11 @@ int Fl_Button::handle(int event) { else { value(oldval); set_changed(); - if (when() & FL_WHEN_CHANGED) do_callback(); + if (when() & FL_WHEN_CHANGED) { + Fl_Widget_Tracker wp(this); + do_callback(); + if (wp.deleted()) return 1; + } } if (when() & FL_WHEN_RELEASE) do_callback(); return 1; @@ -156,6 +160,7 @@ int Fl_Button::handle(int event) { if (Fl::focus() == this && Fl::event_key() == ' ' && !(Fl::event_state() & (FL_SHIFT | FL_CTRL | FL_ALT | FL_META))) { set_changed(); + Fl_Widget_Tracker wp(this); if (type() == FL_RADIO_BUTTON && !value_) { setonly(); if (when() & FL_WHEN_CHANGED) do_callback(); @@ -163,6 +168,7 @@ int Fl_Button::handle(int event) { value(!value()); if (when() & FL_WHEN_CHANGED) do_callback(); } + if (wp.deleted()) return 1; if (when() & FL_WHEN_RELEASE) do_callback(); return 1; } |
