From 36e719a0b297b6d0df64ac87c87fb3220c3a715b Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 20 Aug 2002 17:12:19 +0000 Subject: [PATCH] Fix infinite loop bug in Fl_Text_Display::resize()... git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2599 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 2 ++ src/Fl_Text_Display.cxx | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 25cf71db3..e5bc05b2f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,7 @@ CHANGES IN FLTK 1.1.0 + - Fl_Text_Display::resize() could go into an infinite + loop if the buffer is emptied. - Fl::handle() didn't pass FL_RELEASE events to the grab() widget if pushed() was set (for proper menu handling...) diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx index 9b0d0b6ee..c72b44b8f 100644 --- a/src/Fl_Text_Display.cxx +++ b/src/Fl_Text_Display.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Text_Display.cxx,v 1.12.2.26 2002/08/15 17:26:46 easysw Exp $" +// "$Id: Fl_Text_Display.cxx,v 1.12.2.27 2002/08/20 17:12:19 easysw Exp $" // // Copyright 2001-2002 by Bill Spitzak and others. // Original code Copyright Mark Edel. Permission to distribute under @@ -301,7 +301,7 @@ void Fl_Text_Display::resize(int X, int Y, int W, int H) { scroll_(mTopLineNumHint, mHorizOffsetHint); // everything will fit in the viewport - if (mNBufferLines < mNVisibleLines) + if (mNBufferLines < mNVisibleLines || mBuffer == NULL || mBuffer->length() == 0) scroll_(1, mHorizOffset); /* if empty lines become visible, there may be an opportunity to display more text by scrolling down */ @@ -1976,5 +1976,5 @@ int Fl_Text_Display::handle(int event) { // -// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.26 2002/08/15 17:26:46 easysw Exp $". +// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.27 2002/08/20 17:12:19 easysw Exp $". //