commit 08195c1d958eb507b5e3a2e2aa18fd3dc238c287
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Thu Nov 24 01:18:21 2022 +0100
Fix potential crash with 32bit ucs4 codepoints
QChar codepoints are 16 bit, so it is not wise to pass blindly a
char_type value to the QChar constructor.
Use the already defined isSpace() helper tht takes care of this issue.
Related to #12519, which is only known to bite with Qt6 for now; this
bug is thus theoretical in 2.3.
---
src/frontends/qt4/GuiFontMetrics.cpp | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/frontends/qt4/GuiFontMetrics.cpp
b/src/frontends/qt4/GuiFontMetrics.cpp
index 5bdbf18..b76538e 100644
--- a/src/frontends/qt4/GuiFontMetrics.cpp
+++ b/src/frontends/qt4/GuiFontMetrics.cpp
@@ -18,9 +18,10 @@
#include "Dimension.h"
#include "support/convert.h"
+#include "support/debug.h"
#include "support/lassert.h"
#include "support/lyxlib.h"
-#include "support/debug.h"
+#include "support/textutils.h"
#define DISABLE_PMPROF
#include "support/pmprof.h"
@@ -424,7 +425,7 @@ int GuiFontMetrics::countExpanders(docstring const & str)
const
bool wasspace = false;
int nexp = 0;
for (char_type c : str)
- if (c > 0x0d && QChar(c).isSpace()) {
+ if (c > 0x0d && isSpace(c)) {
if (!wasspace) {
++nexp;
wasspace = true;
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs