Use QScopedPointer to store decoration object
This simplifies memory management.
This commit is contained in:
parent
1e634be2f5
commit
637d914f9f
2 changed files with 4 additions and 5 deletions
|
@ -2343,14 +2343,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;
|
||||
|
|
Loading…
Reference in a new issue