On Fri, Apr 15, 2011 at 12:09:30AM +0200, Peter Kuemmel wrote:
> 
> -------- Original-Nachricht --------
> > Datum: Thu, 14 Apr 2011 23:58:57 +0200
> > Von: Enrico Forestieri <for...@lyx.org>
> > An: lyx-devel@lists.lyx.org
> > Betreff: Re: #7394, Crash in reverse serach
> 
> > On Thu, Apr 14, 2011 at 09:53:46PM +0200, Peter Kuemmel wrote:
> > > This patch
> > > 
> > >     http://www.lyx.org/trac/attachment/ticket/7394/resetAnchor.patch
> > > 
> > > fixes the crash in
> > > 
> > >     http://www.lyx.org/trac/ticket/7394
> > > 
> > > But I don't know if it introduces any side effects.
> > 
> > This is not the correct fix, and neither is removing anchor_.clear().
> > For example, the assert is avoided but when you shift-click, the entire
> > document from the beginning gets selected and not from the cursor
> > position. Please, find attached the correct fix.
> > 
> > -- 
> 
> Good, you found a fix, could you commit.
> 
> But 
>       anchor_ = doc_iterator_begin(buffer());
>       anchor_.clear();
> 
> makes no sense anyway. (It was added by Andre 2008).

Might be equivalent to anchor_ = DocIterator(buffer(), buffer()->inset())?

Seems to have changed a few times:

  8472    poenitz       clear();
 31795        xxx       push_back(CursorSlice(buffer()->inset()));
 31795        xxx       anchor_ = doc_iterator_begin(buffer());
 22898    poenitz       anchor_.clear();

So at time 22898 it was not immediately obvious that someone would
touch some additional code in between at time 31795, and even now it's not
clear there was no code between line 3 and 4 at time 31795, after
all there could have been something that was removed later...

Also, 31795 seems innocent:
-       push_back(CursorSlice(inset));
-       anchor_ = doc_iterator_begin(&inset.buffer(), &inset);
+       push_back(CursorSlice(buffer()->inset()));
+       anchor_ = doc_iterator_begin(buffer());

Andre'

Reply via email to