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
This commit is contained in:
Matthias Melcher 2010-10-30 16:50:44 +00:00
parent 9b2d8347de
commit ff09e7237c
3 changed files with 9 additions and 18 deletions

View File

@ -32,6 +32,7 @@ README.Unix.txt - 2010-10-28 - Building FLTK on Unix
* TODO: we still need to write these chapters
1 INTRODUCTION
=================
@ -42,6 +43,10 @@ platforms:
- Code::Blocks
- ...
The Symbol font and the Zapf Dingbats font do not work on X11. This is correct
behavior for UTF-8 platforms.
2 PREREQUISITES
==================
@ -82,8 +87,6 @@ To update to the latest version, just go into the fltk-1.3 directory and type
svn update
FIXME: no FL_SYMBOL font (-*-symbol-*), font 15 (Zapf-Dingbats)
2.2 Linux Mint 9
-------------------

View File

@ -4192,7 +4192,7 @@
590C56F672356072A5C86BC3 /* valuators.fl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.fluid; name = valuators.fl; path = ../../test/valuators.fl; sourceTree = SOURCE_ROOT; };
598DD70F89D7731D61BBD8EF /* fractals.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fractals.cxx; path = ../../test/fractals.cxx; sourceTree = SOURCE_ROOT; };
59EAC37D26FEC2AB49D79C08 /* Fl_Radio_Button.H */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Fl_Radio_Button.H; path = ../../FL/Fl_Radio_Button.H; sourceTree = SOURCE_ROOT; };
5A7532B3CDA46030885D1D14 /* Fl_Button.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Button.cxx; path = ../../src/Fl_Button.cxx; sourceTree = SOURCE_ROOT; };
5A7532B3CDA46030885D1D14 /* Fl_Button.cxx */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Button.cxx; path = ../../src/Fl_Button.cxx; sourceTree = SOURCE_ROOT; tabWidth = 8; };
5AE1F936F1C186E18C1B9C28 /* is_spacing.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = is_spacing.c; path = ../../src/xutf8/is_spacing.c; sourceTree = SOURCE_ROOT; };
5AF5119D08DFC92EA1032671 /* Fl_Slider.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Slider.cxx; path = ../../src/Fl_Slider.cxx; sourceTree = SOURCE_ROOT; };
5B2B6ED6A3649923BAAFFDF1 /* Fl_visual.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_visual.cxx; path = ../../src/Fl_visual.cxx; sourceTree = SOURCE_ROOT; };

View File

@ -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();