Workaround crash in Aurorae destruction

Summary:
Workaround QtBug-68997

Deleting of a RenderControl/render controlled window triggers deletion
of other queued deleted items, putting KWin in a corrupt state. See Qt
bug report.

Deleting this queued means we know we don't have anything else going on
in the stack which should make this somewhat safe.

BUG: 395346

Test Plan:
Couldn't reproduce original crash. Based purely on the incomplete backtrace and code reading

Set an Aurorae theme. Closed some windows. Things still worked as before

Reviewers: #kwin, #plasma, mart

Reviewed By: #kwin, #plasma, mart

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13614
This commit is contained in:
David Edmundson 2018-06-20 09:37:55 +01:00
parent e92b9a65d8
commit 275b7ee0f4
2 changed files with 9 additions and 7 deletions

View file

@ -270,8 +270,6 @@ Decoration::~Decoration()
if (m_context) {
m_context->makeCurrent(m_offscreenSurface.data());
delete m_renderControl;
delete m_view.data();
m_fbo.reset();
delete m_item;
@ -324,8 +322,8 @@ void Decoration::init()
m_item->setParentItem(visualParent.value<QQuickItem*>());
visualParent.value<QQuickItem*>()->setProperty("drawBackground", false);
} else {
m_renderControl = new QQuickRenderControl(this);
m_view = new QQuickWindow(m_renderControl);
m_renderControl.reset(new QQuickRenderControl);
m_view = new QQuickWindow(m_renderControl.data());
bool usingGL = m_view->rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL;
m_view->setColor(Qt::transparent);
m_view->setFlags(Qt::FramelessWindowHint);
@ -392,8 +390,8 @@ void Decoration::init()
}
m_updateTimer->start();
};
connect(m_renderControl, &QQuickRenderControl::renderRequested, this, requestUpdate);
connect(m_renderControl, &QQuickRenderControl::sceneChanged, this, requestUpdate);
connect(m_renderControl.data(), &QQuickRenderControl::renderRequested, this, requestUpdate);
connect(m_renderControl.data(), &QQuickRenderControl::sceneChanged, this, requestUpdate);
m_item->setParentItem(m_view->contentItem());

View file

@ -87,7 +87,11 @@ private:
KWin::Borders *m_extendedBorders;
KWin::Borders *m_padding;
QString m_themeName;
QQuickRenderControl *m_renderControl = nullptr;
//workaround QtBug-68997
//deleting of a RenderControl/controlled window triggers deletion of other queued deleted items
//deleting this queued means we know we're not processing anything else at the same time and should minimise the damage
QScopedPointer<QQuickRenderControl, QScopedPointerDeleteLater> m_renderControl;
QScopedPointer<QTimer> m_updateTimer;
QScopedPointer<QOpenGLContext> m_context;
QScopedPointer<QOffscreenSurface> m_offscreenSurface;