[LyX/master] Make MathData::pos2x() handle no dim data
Koji Yokota
yokota at lyx.org
Sat May 2 06:29:43 UTC 2026
commit 5883f504887db4cde11deb2c93c37a5e2183e62f
Author: Koji Yokota <yokota at lyx.org>
Date: Sat May 2 15:28:39 2026 +0900
Make MathData::pos2x() handle no dim data
Canceling preedit input while some text is selected in an math text
inset creates math data without dimension, which causes SIGSEGV in
MathData::pos2x(). Treat no dimension inset just to have zero x width.
---
src/mathed/MathData.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp
index 82153b2cc1..7026c49b7f 100644
--- a/src/mathed/MathData.cpp
+++ b/src/mathed/MathData.cpp
@@ -950,7 +950,8 @@ int MathData::pos2x(BufferView const * bv, size_type pos) const
const_iterator it = begin() + i;
//lyxerr << "char: " << (*it)->getChar()
// << "width: " << (*it)->width() << endl;
- x += coords.dim((*it).nucleus()).wid;
+ if (coords.hasDim((*it).nucleus()))
+ x += coords.dim((*it).nucleus()).wid;
}
return x;
}
More information about the lyx-cvs
mailing list