Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Fix crash in Qt6 when iterating over propertyIds in text.

Wolthera van Hövell tot Westerflier57685f111e4a
diff --git a/libs/flake/text/KoSvgTextShape.cpp b/libs/flake/text/KoSvgTextShape.cpp
index f6b3e19469..811e021af0 100644
--- a/libs/flake/text/KoSvgTextShape.cpp
+++ b/libs/flake/text/KoSvgTextShape.cpp
@@ -1187,18 +1187,20 @@ bool KoSvgTextShape::insertRichText(int pos, const KoSvgTextShape *richText, boo
}
if (richTextIt != d->textData.childEnd()) {
- for (auto p = richTextIt->properties.properties().begin(); p != richTextIt->properties.properties().end(); p++) {
- if (KoSvgTextProperties::propertyIsBlockOnly(*p)) {
- richTextIt->properties.removeProperty(*p);
+ Q_FOREACH (const KoSvgTextProperties::PropertyId p, richTextIt->properties.properties()) {
+ if (KoSvgTextProperties::propertyIsBlockOnly(p)) {
+ richTextIt->properties.removeProperty(p);
}
}
auto parentIt = KisForestDetail::hierarchyBegin(richTextIt);
auto parentEnd = KisForestDetail::hierarchyEnd(richTextIt);
- parentIt++;
- if (inheritPropertiesIfPossible && parentIt!= parentEnd) {
- for (auto p = richTextIt->properties.properties().begin(); p != richTextIt->properties.properties().end(); p++) {
- if (richTextIt->properties.inheritsProperty(*p, parentIt->properties)) {
- richTextIt->properties.removeProperty(*p);
+ if (parentIt != parentEnd) {
+ parentIt++;
+ if (inheritPropertiesIfPossible && parentIt != parentEnd) {
+ Q_FOREACH (const KoSvgTextProperties::PropertyId p, richTextIt->properties.properties()) {
+ if (richTextIt->properties.inheritsProperty(p, parentIt->properties)) {
+ richTextIt->properties.removeProperty(p);
+ }
}
}
}