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 an assert on clicking on File Layer's properties

Dmitry Kazakov156c8a1a92b4
diff --git a/libs/image/commands/kis_node_property_list_command.cpp b/libs/image/commands/kis_node_property_list_command.cpp
index 9abe9548e3..fe354c6675 100644
--- a/libs/image/commands/kis_node_property_list_command.cpp
+++ b/libs/image/commands/kis_node_property_list_command.cpp
@@ -228,8 +228,8 @@ void KisNodePropertyListCommand::setNodePropertiesAutoUndo(KisNodeSP node, KisIm
const QSet<QString> properties = changedProperties(node->sectionModelProperties(), proplist);
const bool undo = !properties.isEmpty() &&
- properties != QSet<QString>{KisLayerPropertiesIcons::colorizeNeedsUpdate.id()} &&
- properties != QSet<QString>{KisLayerPropertiesIcons::openFileLayerFile.id()};
+ (properties.size() != 1 ||
+ !KisLayerPropertiesIcons::isStatelessProperty(*properties.begin()));
QScopedPointer<KUndo2Command> cmd(new KisNodePropertyListCommand(node, proplist));
diff --git a/libs/image/kis_layer_properties_icons.cpp b/libs/image/kis_layer_properties_icons.cpp
index a08eec5aa2..1f07d78e19 100644
--- a/libs/image/kis_layer_properties_icons.cpp
+++ b/libs/image/kis_layer_properties_icons.cpp
@@ -174,3 +174,13 @@ QVariant KisLayerPropertiesIcons::nodeProperty(KisNodeSP node, const KoID &id, c
return defaultValue;
}
+
+bool KisLayerPropertiesIcons::isStatelessProperty(const QString &id)
+{
+ return
+ id == colorizeNeedsUpdate.id() ||
+ id == openFileLayerFile.id() ||
+ id == layerError.id() ||
+ id == layerColorSpaceMismatch.id() ||
+ id == colorOverlay.id();
+}
diff --git a/libs/image/kis_layer_properties_icons.h b/libs/image/kis_layer_properties_icons.h
index 23f4bfb777..7e0f670142 100644
--- a/libs/image/kis_layer_properties_icons.h
+++ b/libs/image/kis_layer_properties_icons.h
@@ -59,6 +59,18 @@ public:
void updateIcons();
+ /**
+ * Check if the property is actually stateless, i.e.
+ * cannot be modified by a requesting change. These
+ * properties are used for things like errors, color
+ * space mismatch requests or colorize mask updates.
+ *
+ * For such properties we should toggle them, but do
+ * not expect the value to actually change. That also
+ * means that they don't need undo/redo functionality.
+ */
+ static bool isStatelessProperty(const QString &id);
+
private:
struct Private;
const QScopedPointer<Private> m_d;