[shadow] Needs to keep a QPointer to the DecorationShadow

The DecorationShadow might be deleted at any time, so we better
keep track of it properly.
This commit is contained in:
Martin Gräßlin 2014-10-28 11:01:43 +01:00
parent 17103c49a1
commit 7353bf4c28
2 changed files with 3 additions and 3 deletions

View file

@ -170,7 +170,7 @@ bool Shadow::init(KDecoration2::Decoration *decoration)
disconnect(m_decorationShadow, &KDecoration2::DecorationShadow::paddingRightChanged, m_topLevel, &Toplevel::getShadow);
disconnect(m_decorationShadow, &KDecoration2::DecorationShadow::paddingBottomChanged, m_topLevel, &Toplevel::getShadow);
}
m_decorationShadow = static_cast<const KDecoration2::Decoration*>(decoration)->shadow();
m_decorationShadow = decoration->shadow();
if (!m_decorationShadow) {
return false;
}

View file

@ -103,7 +103,7 @@ public:
void setToplevel(Toplevel *toplevel);
bool hasDecorationShadow() const {
return m_decorationShadow;
return !m_decorationShadow.isNull();
}
QImage decorationShadowImage() const;
@ -170,7 +170,7 @@ private:
QRegion m_shadowRegion;
QSize m_cachedSize;
// Decoration based shadows
KDecoration2::DecorationShadow *m_decorationShadow;
QPointer<KDecoration2::DecorationShadow> m_decorationShadow;
};
}