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 --- src/Fl_Counter.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/Fl_Counter.cxx') diff --git a/src/Fl_Counter.cxx b/src/Fl_Counter.cxx index b77fc8a4c..de83f15d5 100644 --- a/src/Fl_Counter.cxx +++ b/src/Fl_Counter.cxx @@ -137,14 +137,19 @@ int Fl_Counter::handle(int event) { return 1; case FL_PUSH: if (Fl::visible_focus()) Fl::focus(this); - handle_push(); + { Fl_Widget_Tracker wp(this); + handle_push(); + if (wp.deleted()) return 1; + } case FL_DRAG: i = calc_mouseobj(); if (i != mouseobj) { Fl::remove_timeout(repeat_callback, this); mouseobj = (uchar)i; if (i) Fl::add_timeout(INITIALREPEAT, repeat_callback, this); + Fl_Widget_Tracker wp(this); increment_cb(); + if (wp.deleted()) return 1; redraw(); } return 1; -- cgit v1.2.3