diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2010-02-07 21:14:35 +0000 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2010-02-07 21:14:35 +0000 |
| commit | ee36ebc394cf2ff297302471467cd8e387e79423 (patch) | |
| tree | 2c562c77c544dce0d595e0aa1385612a87cc04a7 /src/Fl_Scroll.cxx | |
| parent | ce7da76d6a219c5fc0a33f9c5b2701f3b47220d6 (diff) | |
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
Diffstat (limited to 'src/Fl_Scroll.cxx')
| -rw-r--r-- | src/Fl_Scroll.cxx | 17 |
1 files changed, 7 insertions, 10 deletions
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 */ |
