Commit 50bfbadf authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

Fix a severe crash in Transformation Masks

We should be really careful with makeCloneFrom() calls. There is a
simple rule of thumb:

"Use makeCloneFrom or makeCloneFromRough if and only of you are the
only owner of the paint device and you are 100% sure no other thread
has access to it"

The reason is simple. These call change offset and a color space of the
paint device, so all the other users with get a SIGSEGV with a non-zero
probability. If you want to copy data to a device, which is shared with
someone else, use KisPainter::copyAreaOptimized() instead. It is totlly
safe.

BUG:349819
parent d35a9baa
...@@ -236,7 +236,8 @@ QRect KisTransformMask::decorateRect(KisPaintDeviceSP &src, ...@@ -236,7 +236,8 @@ QRect KisTransformMask::decorateRect(KisPaintDeviceSP &src,
if (m_d->recalculatingStaticImage) { if (m_d->recalculatingStaticImage) {
m_d->staticCacheDevice->clear(); m_d->staticCacheDevice->clear();
m_d->params->transformDevice(const_cast<KisTransformMask*>(this), src, m_d->staticCacheDevice); m_d->params->transformDevice(const_cast<KisTransformMask*>(this), src, m_d->staticCacheDevice);
dst->makeCloneFrom(m_d->staticCacheDevice, m_d->staticCacheDevice->extent()); QRect updatedRect = m_d->staticCacheDevice->extent();
KisPainter::copyAreaOptimized(updatedRect.topLeft(), m_d->staticCacheDevice, dst, updatedRect);
#ifdef DEBUG_RENDERING #ifdef DEBUG_RENDERING
qDebug() << "Recalculate" << name() << ppVar(src->exactBounds()) << ppVar(dst->exactBounds()) << ppVar(rc); qDebug() << "Recalculate" << name() << ppVar(src->exactBounds()) << ppVar(dst->exactBounds()) << ppVar(rc);
......
Supports Markdown
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