r24244 by jghali - Fix incorrect usage of icu::BreakIterator's setText()
scribus-commit
scribus-commit at lists.scribus.net
Sat Nov 14 17:00:14 UTC 2020
Author: jghali
Date: Sat Nov 14 17:00:13 2020
New Revision: 24244
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24244
Log:
Fix incorrect usage of icu::BreakIterator's setText()
Modified:
trunk/Scribus/scribus/text/scworditerator.cpp
trunk/Scribus/scribus/text/scworditerator.h
Modified: trunk/Scribus/scribus/text/scworditerator.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24244&path=/trunk/Scribus/scribus/text/scworditerator.cpp
==============================================================================
--- trunk/Scribus/scribus/text/scworditerator.cpp (original)
+++ trunk/Scribus/scribus/text/scworditerator.cpp Sat Nov 14 17:00:13 2020
@@ -23,6 +23,11 @@
delete m_wordIterator;
m_wordIterator = nullptr;
}
+ if (m_unicodeString)
+ {
+ delete m_unicodeString;
+ m_unicodeString = nullptr;
+ }
}
BreakIterator* ScWordIterator::getWordIterator()
@@ -39,7 +44,13 @@
return nullptr;
}
- m_wordIterator->setText((const UChar*) m_story.plainText().utf16());
+ if (m_unicodeString)
+ {
+ delete m_unicodeString;
+ m_unicodeString = nullptr;
+ }
+ m_unicodeString = new icu::UnicodeString((const UChar*) m_story.plainText().utf16());
+ m_wordIterator->setText(*m_unicodeString);
return m_wordIterator;
}
Modified: trunk/Scribus/scribus/text/scworditerator.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24244&path=/trunk/Scribus/scribus/text/scworditerator.h
==============================================================================
--- trunk/Scribus/scribus/text/scworditerator.h (original)
+++ trunk/Scribus/scribus/text/scworditerator.h Sat Nov 14 17:00:13 2020
@@ -16,6 +16,7 @@
U_NAMESPACE_BEGIN
class BreakIterator;
+class UnicodeString;
U_NAMESPACE_END
class SCRIBUS_API ScWordIterator
@@ -32,6 +33,7 @@
QString word(int pos);
private:
+ icu::UnicodeString* m_unicodeString { nullptr };
icu::BreakIterator* m_wordIterator { nullptr };
StoryText& m_story;
More information about the scribus-commit
mailing list