Le 20/12/2024 à 01:25, Pavel Sanda a écrit :
On Wed, Dec 18, 2024 at 02:08:13PM +0100, Jean-Marc Lasgouttes wrote:
Thanks for the backtrace. So is it only a thing in branch? Note that the
assertion in ParagraphMetrics::position() is new, so this might be an
old problem that we detect only now.

The patch below should fix the symptom, and I think there is no other cause
to cure. I am not sure, though, since I do not understand this
beforeDisplayPosX stuff.

I can reproduce the crash with the current master.

The good news: I have recipe for reproducing in almost 100% of cases on one 
machine now.
The bad news: the patch does not solve the crash.

Does this new patch help? It contains the previous one.

What I think here is that an update is missing somewhere.

Can you give me a recipe using one of our documentation files, for example?

JMarc

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index e7aa2826c9..1dc04af678 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -3473,7 +3473,7 @@ bool BufferView::paragraphVisible(DocIterator const & dit) const
 	CursorSlice const & bot = dit.bottom();
 	TextMetrics const & tm = textMetrics(bot.text());
 
-	return tm.contains(bot.pit());
+	return tm.contains(bot.pit()) && tm.parMetrics(bot.pit()).hasPosition();
 }
 
 
diff --git a/src/Cursor.cpp b/src/Cursor.cpp
index fa844b2946..58647f7c49 100644
--- a/src/Cursor.cpp
+++ b/src/Cursor.cpp
@@ -772,7 +772,8 @@ bool Cursor::getStatus(FuncRequest const & cmd, FuncStatus & status) const
 
 void Cursor::saveBeforeDispatchPosXY()
 {
-	getPos(beforeDispatchPosX_, beforeDispatchPosY_);
+	if (bv().paragraphVisible(*this))
+		getPos(beforeDispatchPosX_, beforeDispatchPosY_);
 }
 
 
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to