Nice catch Bart, I'm currently on holydays in the south of France and I can't commit the fix to CVS (I'm currently living off a very limiter GPRS mobile phone internet connection ;-) ). I think Olivier or Vincent will commit it very soon.
Thanks! Sebastien Bartlomiej Bazior said: > Hi, > > I noticed there is a bug in nglConsole AddToHistory and SetHistory > methods, which causes an aplication to crash when console > history limit is reached. The following patch seems to resolve > the problem: > > > --- nglConsole_shr.cpp Sat Jul 16 21:27:38 2005 > +++ nglConsole_shr_new.cpp Sat Jul 16 21:37:46 2005 > @@ -76,12 +76,13 @@ > ((CharMax > 0) && (mCharCnt > CharMax)))) > { > list<nglString*>::iterator tail = mHistory.end(); > + tail--; //mHistory.end() return an iterator just past the last element > of a list, so tail needs to be decremented > if (*tail) > { > mCharCnt -= (*tail)->GetLength(); > mLineCnt--; > + delete (*tail); > mHistory.erase (tail); > - delete (*tail); > } > } > mLineMax = LineMax; > @@ -113,12 +114,14 @@ > ((mCharMax > 0) && (new_charcnt > mCharMax)))) > { > list<nglString*>::iterator tail = mHistory.end(); > + tail--; > if (*tail) > { > new_charcnt -= (*tail)->GetLength(); > new_linecnt--; > + delete (*tail); > mHistory.erase (tail); > - delete (*tail); > } > } > newline = new nglString (rLine); > > > cheers, > Bart > -- > "When the only tool you know is a hammer, > every problem looks like a nail." > > _______________________________________________ > https://mail.gna.org/listinfo/ngl-devel > -- Sebastien Metrot Ultimate Sound Bank (http://www.usbsounds.com) Lead Dev. --------- NGL/NUI Author (http://home.gna.org/ngl)