mirror of
https://github.com/NohamR/Reclass.git
synced 2026-05-10 19:59:21 +00:00
Fix QSci assert on msvc with text being nullptr
This commit is contained in:
@@ -3262,6 +3262,11 @@ void RcxEditor::setCommandRowText(const QString& line) {
|
||||
m_sci->SendScintilla(QsciScintillaBase::SCI_SETUNDOCOLLECTION, 0);
|
||||
m_sci->setReadOnly(false);
|
||||
|
||||
// Suppress modification notifications during replace to avoid
|
||||
// QScintilla accessibility crash (textDeleted called with null text).
|
||||
long savedMask = m_sci->SendScintilla(QsciScintillaBase::SCI_GETMODEVENTMASK);
|
||||
m_sci->SendScintilla(QsciScintillaBase::SCI_SETMODEVENTMASK, 0);
|
||||
|
||||
long start = m_sci->SendScintilla(QsciScintillaBase::SCI_POSITIONFROMLINE, 0);
|
||||
long end = m_sci->SendScintilla(QsciScintillaBase::SCI_GETLINEENDPOSITION, 0);
|
||||
QByteArray utf8 = s.toUtf8();
|
||||
@@ -3270,6 +3275,8 @@ void RcxEditor::setCommandRowText(const QString& line) {
|
||||
m_sci->SendScintilla(QsciScintillaBase::SCI_SETTARGETEND, end);
|
||||
m_sci->SendScintilla(QsciScintillaBase::SCI_REPLACETARGET, (uintptr_t)utf8.size(), utf8.constData());
|
||||
|
||||
m_sci->SendScintilla(QsciScintillaBase::SCI_SETMODEVENTMASK, savedMask);
|
||||
|
||||
// Adjust saved cursor/anchor for length change in line 0
|
||||
long delta = (long)utf8.size() - oldLen;
|
||||
if (savedPos > end) savedPos += delta;
|
||||
|
||||
Reference in New Issue
Block a user