summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-10-03 10:05:20 +0200
committerJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-10-04 09:15:57 +0200
commit11f2e7df5762a23e66d1755b34f5f3d07208ae32 (patch)
treebb65fc78010bf3733fec8693a9fc40ba7b6c28cf
parent1ed0782e93dafb0a3d5ef3a02c9c3999825817ee (diff)
Compositor: Fix crash when trying to maximize an XdgToplevel with no output
Fixes: QTBUG-78969 Change-Id: I4ecde3725b5307251070e331c97d96df328a3772 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
-rw-r--r--src/compositor/extensions/qwaylandxdgshellintegration.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/compositor/extensions/qwaylandxdgshellintegration.cpp b/src/compositor/extensions/qwaylandxdgshellintegration.cpp
index 3de52944b..08e098210 100644
--- a/src/compositor/extensions/qwaylandxdgshellintegration.cpp
+++ b/src/compositor/extensions/qwaylandxdgshellintegration.cpp
@@ -179,8 +179,12 @@ void XdgToplevelIntegration::handleUnsetMaximized()
void XdgToplevelIntegration::handleMaximizedChanged()
{
if (m_toplevel->maximized()) {
- QWaylandOutput *output = m_item->view()->output();
- m_item->moveItem()->setPosition(output->position() + output->availableGeometry().topLeft());
+ if (auto *output = m_item->view()->output()) {
+ m_item->moveItem()->setPosition(output->position() + output->availableGeometry().topLeft());
+ } else {
+ qCWarning(qLcWaylandCompositor) << "The view does not have a corresponding output,"
+ << "ignoring maximized state";
+ }
} else {
m_item->moveItem()->setPosition(windowedGeometry.initialPosition);
}
@@ -232,7 +236,12 @@ void XdgToplevelIntegration::handleFullscreenChanged()
{
if (m_toplevel->fullscreen()) {
QWaylandOutput *output = m_item->view()->output();
- m_item->moveItem()->setPosition(output->position() + output->geometry().topLeft());
+ if (auto *output = m_item->view()->output()) {
+ m_item->moveItem()->setPosition(output->position() + output->geometry().topLeft());
+ } else {
+ qCWarning(qLcWaylandCompositor) << "The view does not have a corresponding output,"
+ << "ignoring fullscreen state";
+ }
} else {
m_item->moveItem()->setPosition(windowedGeometry.initialPosition);
}