The following patches fix a crash:
http://bugzilla.lyx.org/show_bug.cgi?id=2600

The problem was the assumption that the LyXText of the cursor is the
same as the LyXText of cursor.selBegin.

I think there are still problems with CT and tables, but I propose to
apply at least this one.

I think that the rest of the problem would be fixed by a proper fix to
bug 2510.

JMarc

Index: src/BufferView_pimpl.C
===================================================================
--- src/BufferView_pimpl.C	(revision 14926)
+++ src/BufferView_pimpl.C	(working copy)
@@ -749,17 +749,11 @@ bool BufferView::Pimpl::available() cons
 
 Change const BufferView::Pimpl::getCurrentChange()
 {
-	if (!buffer_->params().tracking_changes)
+	if (!buffer_->params().tracking_changes || !cursor_.selection())
 		return Change(Change::UNCHANGED);
 
-	LyXText * text = bv_->getLyXText();
-	LCursor & cur = cursor_;
-
-	if (!cur.selection())
-		return Change(Change::UNCHANGED);
-
-	return text->getPar(cur.selBegin().pit()).
-			lookupChangeFull(cur.selBegin().pos());
+	DocIterator dit = cursor_.selectionBegin();
+	return dit.paragraph().lookupChangeFull(dit.pos());
 }
 
 
Index: src/BufferView_pimpl.C
===================================================================
--- src/BufferView_pimpl.C	(revision 14924)
+++ src/BufferView_pimpl.C	(working copy)
@@ -586,17 +586,11 @@ bool BufferView::Pimpl::available() cons
 
 Change const BufferView::Pimpl::getCurrentChange()
 {
-	if (!buffer_->params().tracking_changes)
+	if (!buffer_->params().tracking_changes || !cursor_.selection())
 		return Change(Change::UNCHANGED);
 
-	LyXText * text = bv_->getLyXText();
-	LCursor & cur = cursor_;
-
-	if (!cur.selection())
-		return Change(Change::UNCHANGED);
-
-	return text->getPar(cur.selBegin().pit()).
-			lookupChange(cur.selBegin().pos());
+	DocIterator dit = cursor_.selectionBegin();
+	return dit.paragraph().lookupChange(dit.pos());
 }
 
 

Reply via email to