summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2016-11-11 14:22:16 +0100
committerJohan Helsing <johan.helsing@qt.io>2016-11-14 11:38:51 +0000
commit928c10b702b9fa73e3ccd185fa9ef1c4580e7409 (patch)
treeee6f36779beba944b81e424e007eb507f4e9b457
parent99c3d12f1a4ac152a80f4ad97a6cee5a0e8bb370 (diff)
Compositor: Set view output in QWaylandQuickItem::init()
This fixes a crash when the constructor of QWaylandXdgPopupV5Integration tries to access the output scale factor. Change-Id: I3cafee7a47b18e1025044b35d4578c7a6258eee4 Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@hawaiios.org> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp7
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem_p.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp
index e6cfce34..d57cbb42 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -1074,11 +1074,16 @@ void QWaylandQuickItem::updateBuffer(bool hasBuffer)
void QWaylandQuickItem::updateWindow()
{
Q_D(QWaylandQuickItem);
+
+ QQuickWindow *newWindow = window();
+ if (newWindow == d->connectedWindow)
+ return;
+
if (d->connectedWindow) {
disconnect(d->connectedWindow, &QQuickWindow::beforeSynchronizing, this, &QWaylandQuickItem::beforeSync);
}
- d->connectedWindow = window();
+ d->connectedWindow = newWindow;
if (d->connectedWindow) {
connect(d->connectedWindow, &QQuickWindow::beforeSynchronizing, this, &QWaylandQuickItem::beforeSync, Qt::DirectConnection);
diff --git a/src/compositor/compositor_api/qwaylandquickitem_p.h b/src/compositor/compositor_api/qwaylandquickitem_p.h
index 5eba9957..441ac976 100644
--- a/src/compositor/compositor_api/qwaylandquickitem_p.h
+++ b/src/compositor/compositor_api/qwaylandquickitem_p.h
@@ -142,6 +142,8 @@ public:
QObject::connect(view.data(), &QWaylandView::outputChanged, q, &QWaylandQuickItem::outputChanged);
QObject::connect(view.data(), &QWaylandView::bufferLockedChanged, q, &QWaylandQuickItem::bufferLockedChanged);
QObject::connect(view.data(), &QWaylandView::allowDiscardFrontBufferChanged, q, &QWaylandQuickItem::allowDiscardFrontBuffer);
+
+ q->updateWindow();
}
void setInputEventsEnabled(bool enable)