[aurorae] QQuickWindow needs to be a QPointer instead of a ScopedPointer

Lifetime is bound to the foreign QWindow of the decoration. Thus if that
gets destroyed our pointer becomes invalid and we need to track that.
This commit is contained in:
Martin Gräßlin 2014-10-27 12:43:39 +01:00
parent 5c3cd6f4bc
commit 16afb24426
2 changed files with 4 additions and 4 deletions

View file

@ -266,7 +266,7 @@ void Decoration::init()
} else { } else {
// we need a QQuickWindow till we depend on Qt 5.4 // we need a QQuickWindow till we depend on Qt 5.4
m_decorationWindow.reset(QWindow::fromWinId(client()->decorationId())); m_decorationWindow.reset(QWindow::fromWinId(client()->decorationId()));
m_view.reset(new QQuickWindow(m_decorationWindow.data())); m_view = new QQuickWindow(m_decorationWindow.data());
m_view->setFlags(Qt::WindowDoesNotAcceptFocus | Qt::WindowTransparentForInput); m_view->setFlags(Qt::WindowDoesNotAcceptFocus | Qt::WindowTransparentForInput);
m_view->setColor(Qt::transparent); m_view->setColor(Qt::transparent);
connect(m_view.data(), &QQuickWindow::beforeRendering, [this]() { connect(m_view.data(), &QQuickWindow::beforeRendering, [this]() {
@ -318,8 +318,8 @@ void Decoration::init()
m_view->lower(); m_view->lower();
m_view->update(); m_view->update();
}; };
connect(m_item, &QQuickItem::widthChanged, this, resizeWindow); connect(client().data(), &KDecoration2::DecoratedClient::widthChanged, this, resizeWindow);
connect(m_item, &QQuickItem::heightChanged, this, resizeWindow); connect(client().data(), &KDecoration2::DecoratedClient::heightChanged, this, resizeWindow);
resizeWindow(); resizeWindow();
} }
} }

View file

@ -66,7 +66,7 @@ private:
QScopedPointer<QOpenGLFramebufferObject> m_fbo; QScopedPointer<QOpenGLFramebufferObject> m_fbo;
QImage m_buffer; QImage m_buffer;
QScopedPointer<QWindow> m_decorationWindow; QScopedPointer<QWindow> m_decorationWindow;
QScopedPointer<QQuickWindow> m_view; QPointer<QQuickWindow> m_view;
QQuickItem *m_item; QQuickItem *m_item;
KWin::Borders *m_borders; KWin::Borders *m_borders;
KWin::Borders *m_maximizedBorders; KWin::Borders *m_maximizedBorders;