From ff09e7237c0ccbab0855d2da87d392810dab69c5 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sat, 30 Oct 2010 16:50:44 +0000 Subject: [PATCH] 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 --- README.Unix.txt | 7 +++++-- ide/Xcode3/FLTK.xcodeproj/project.pbxproj | 2 +- src/Fl_Button.cxx | 18 +++--------------- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/README.Unix.txt b/README.Unix.txt index 2ffe12543..6bdb28354 100644 --- a/README.Unix.txt +++ b/README.Unix.txt @@ -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 ------------------- diff --git a/ide/Xcode3/FLTK.xcodeproj/project.pbxproj b/ide/Xcode3/FLTK.xcodeproj/project.pbxproj index 777772270..00a98273f 100644 --- a/ide/Xcode3/FLTK.xcodeproj/project.pbxproj +++ b/ide/Xcode3/FLTK.xcodeproj/project.pbxproj @@ -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; }; 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();