[Calligra] 4f964e6 Checked KisBaseNode for the thread-safety

Dmitry Kazakov dimula73 at gmail.com
Mon Dec 13 22:24:14 CET 2010


commit 4f964e659a5f5ee10f9e768917f8ad1a1e1803d4
branch master
Author: Dmitry Kazakov <dimula73 at gmail.com>
Date:   Mon Dec 13 23:59:51 2010 +0300

    Checked KisBaseNode for the thread-safety
    
    It sounds like the couple KisBaseNode+KoProperties is thread-safe here.
    Though it isn't officially supported by Qt, but our environment is
    very soft (one writer + many readers, only existent keys of QMap can
    be written), so it works.
    
    Added a warning message to the KisBaseNode stating that.
    
    CCMAIL:kimageshop at kde.org

diff --git a/krita/image/kis_base_node.cpp b/krita/image/kis_base_node.cpp
index d375e98..2262716 100644
--- a/krita/image/kis_base_node.cpp
+++ b/krita/image/kis_base_node.cpp
@@ -37,8 +37,18 @@ public:
 KisBaseNode::KisBaseNode()
     : m_d(new Private())
 {
+    /**
+     * Be cautions! These two calls are vital to warm-up KoProperties.
+     * We use it and its QMap in a threaded environment. This is not
+     * officially suported by Qt, but our environment guarantees, that
+     * there will be the only writer and several readers. Whilst the
+     * value of the QMap is boolean and there are no implicit-sharing
+     * calls provocated, it is safe to work with it in such an
+     * environment.
+     */
     setVisible(true);
     setUserLocked(false);
+
     setSystemLocked(false);
     m_d->linkedTo = 0;
     m_d->compositeOp = COMPOSITE_OVER;


More information about the kimageshop mailing list