From ee36ebc394cf2ff297302471467cd8e387e79423 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sun, 7 Feb 2010 21:14:35 +0000 Subject: Reverting previous change (optimization of Fl_Group::clear), because fl_throw_focus and fl_fix_focus would send events that could access deleted widgets. This must be fixed first. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7039 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Scroll.cxx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/Fl_Scroll.cxx') diff --git a/src/Fl_Scroll.cxx b/src/Fl_Scroll.cxx index 333c4892d..085d47bf0 100644 --- a/src/Fl_Scroll.cxx +++ b/src/Fl_Scroll.cxx @@ -32,16 +32,13 @@ /** Clear all but the scrollbars... */ void Fl_Scroll::clear() { - // Note: the scrollbars are removed from the group before - // calling Fl_Group::clear() to take advantage of the - // optimized widget removal. Finally they are added - // to the Fl_Scroll's group again. - // This is MUCH faster than removing each widget. - remove(scrollbar); - remove(hscrollbar); - Fl_Group::clear(); - add(hscrollbar); - add(scrollbar); + for (int i=children() - 1; i >= 0; i --) { + Fl_Widget* o = child(i); + if (o != &hscrollbar && o != &scrollbar) { + remove(o); + delete o; + } + } } /** Insure the scrollbars are the last children */ -- cgit v1.2.3