Commit 71a5b00d authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Use QScopedPointer to store decoration object

This simplifies memory management.

(cherry picked from commit 637d914f)
parent ea84b1ca
......@@ -2362,14 +2362,13 @@ void AbstractClient::createDecoration(const QRect &oldGeometry)
void AbstractClient::destroyDecoration()
{
delete m_decoration.decoration;
setDecoration(nullptr);
m_decoration.inputRegion = QRegion();
}
void AbstractClient::setDecoration(KDecoration2::Decoration *decoration)
{
m_decoration.decoration = decoration;
m_decoration.decoration.reset(decoration);
Q_EMIT decorationChanged();
}
......
......@@ -742,10 +742,10 @@ public:
// decoration related
KDecoration2::Decoration *decoration() {
return m_decoration.decoration;
return m_decoration.decoration.data();
}
const KDecoration2::Decoration *decoration() const {
return m_decoration.decoration;
return m_decoration.decoration.data();
}
bool isDecorated() const {
return m_decoration.decoration != nullptr;
......@@ -1323,7 +1323,7 @@ private:
} m_interactiveMoveResize;
struct {
KDecoration2::Decoration *decoration = nullptr;
QScopedPointer<KDecoration2::Decoration> decoration;
QPointer<Decoration::DecoratedClientImpl> client;
QElapsedTimer doubleClickTimer;
QRegion inputRegion;
......
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