Commit 82e118f5 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix ghost layer content appearing after creating a new (second) layer

When there is only one layer in the group, the group has no
projection at all. So when adding a layer, which changes the number of
layers from 1 to 2, the stack should be updated to populate the group's

Fixes T2073
parent ce2118c9
......@@ -269,6 +269,11 @@ KisPaintDeviceSP KisGroupLayer::original() const
return realOriginal;
bool KisGroupLayer::projectionIsValid() const
return !tryObligeChild();
void KisGroupLayer::setDefaultProjectionColor(KoColor color)
......@@ -102,6 +102,8 @@ public:
QRect extent() const;
QRect exactBounds() const;
bool projectionIsValid() const;
KisLayer* onlyMeaningfulChild() const;
KisPaintDeviceSP tryObligeChild() const;
......@@ -414,6 +414,11 @@ void KisLayerManager::addLayerCommon(KisNodeSP activeNode, KisLayerSP layer, boo
KisNodeSP above;
adjustLayerPosition(layer, activeNode, parent, above);
KisGroupLayer *group = dynamic_cast<KisGroupLayer*>(;
const bool parentForceUpdate = group && !group->projectionIsValid();
updateImage |= parentForceUpdate;
m_commandsAdapter->addNode(layer, parent, above, updateImage, updateImage);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment