mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
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.
This commit is contained in:
parent
52ea367982
commit
08195c1d95
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user