diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2010-10-30 16:50:44 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2010-10-30 16:50:44 +0000 |
| commit | ff09e7237c0ccbab0855d2da87d392810dab69c5 (patch) | |
| tree | a0dee23b552e148b58c9ab50226c3ae112a353b5 /src/Fl_Button.cxx | |
| parent | 9b2d8347de32eb0f9a8addfce668768b67df67c0 (diff) | |
Fl_Button shortcut handling would crash if the widget was deleted in the callback.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7774 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Button.cxx')
| -rw-r--r-- | src/Fl_Button.cxx | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/Fl_Button.cxx b/src/Fl_Button.cxx index 23b974039..167f5287c 100644 --- a/src/Fl_Button.cxx +++ b/src/Fl_Button.cxx @@ -128,22 +128,9 @@ int Fl_Button::handle(int event) { return 1; case FL_SHORTCUT: if (!(shortcut() ? - Fl::test_shortcut(shortcut()) : test_shortcut())) return 0; - + Fl::test_shortcut(shortcut()) : test_shortcut())) return 0; if (Fl::visible_focus() && handle(FL_FOCUS)) Fl::focus(this); - - if (type() == FL_RADIO_BUTTON && !value_) { - setonly(); - set_changed(); - if (when() & (FL_WHEN_CHANGED|FL_WHEN_RELEASE) ) - do_callback(); - } else if (type() == FL_TOGGLE_BUTTON) { - value(!value()); - set_changed(); - if (when() & (FL_WHEN_CHANGED|FL_WHEN_RELEASE)) - do_callback(); - } else if (when() & FL_WHEN_RELEASE) do_callback(); - return 1; + goto triggered_by_keyboard; case FL_FOCUS : /* FALLTHROUGH */ case FL_UNFOCUS : if (Fl::visible_focus()) { @@ -161,6 +148,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(); + triggered_by_keyboard: Fl_Widget_Tracker wp(this); if (type() == FL_RADIO_BUTTON && !value_) { setonly(); |
