Commit 8f7603cc authored by Boudewijn Rempt's avatar Boudewijn Rempt

BUG:357987 Don't crash on loading the given file

If the clone layers clone a layer above the clones in the stack,
the original isn't available during loading. Krita shouldn't recalculate
the project at this point, but merging already starts before the
original is available, so add a temporary dummy fallback paint
device that can be used until the original becomes available.
parent 77b39d84
......@@ -47,6 +47,7 @@ struct Q_DECL_HIDDEN KisCloneLayer::Private
KisPaintDeviceSP fallback;
KisLodCapableLayerOffset offset;
KisLayerSP copyFrom;
......@@ -58,6 +59,7 @@ KisCloneLayer::KisCloneLayer(KisLayerSP from, KisImageWSP image, const QString &
: KisLayer(image, name, opacity)
, m_d(new Private(new KisDefaultBounds(image)))
m_d->fallback = new KisPaintDevice(image->colorSpace());
m_d->copyFrom = from;
m_d->type = COPY_PROJECTION;
......@@ -71,6 +73,7 @@ KisCloneLayer::KisCloneLayer(const KisCloneLayer& rhs)
: KisLayer(rhs)
, m_d(new Private(new KisDefaultBounds(rhs.image())))
m_d->fallback = new KisPaintDevice(rhs.m_d->fallback->colorSpace());
m_d->copyFrom = rhs.copyFrom();
m_d->type = rhs.copyType();
m_d->offset = rhs.m_d->offset;
......@@ -112,8 +115,7 @@ KisPaintDeviceSP KisCloneLayer::paintDevice() const
KisPaintDeviceSP KisCloneLayer::original() const
if (!m_d->copyFrom || !m_d->copyFrom->projection()) return m_d->fallback;
KisPaintDeviceSP retval;
switch (m_d->type) {
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