summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-10-21 13:13:00 +0200
committerJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-10-22 09:14:09 +0200
commit3d10b7b2de61dbfb64a29f9190962f316f7012f1 (patch)
tree86c1a78a67fa69e147a410791aa1caf627891223
parent90b79bfb3bed86bc560725774a7c7e48375e3389 (diff)
Compositor: Fix crashes when destroying uninitialized surfaces
This happened when running qmlplugindump for QtWayland. [ChangeLog][Compositor] Fixed a crash when destroying WaylandSurfaces and WlShellSurfaces which had not yet been initialized. Change-Id: Ia35cc1ccddc6146453d4dbba0ffd41a012a526e3 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.cpp3
-rw-r--r--src/compositor/extensions/qwaylandwlshell.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp
index a82c93f7b..8c866351f 100644
--- a/src/compositor/compositor_api/qwaylandsurface.cpp
+++ b/src/compositor/compositor_api/qwaylandsurface.cpp
@@ -391,7 +391,8 @@ QWaylandSurface::QWaylandSurface(QWaylandSurfacePrivate &dptr)
QWaylandSurface::~QWaylandSurface()
{
Q_D(QWaylandSurface);
- QWaylandCompositorPrivate::get(d->compositor)->unregisterSurface(this);
+ if (d->compositor)
+ QWaylandCompositorPrivate::get(d->compositor)->unregisterSurface(this);
d->notifyViewsAboutDestruction();
}
diff --git a/src/compositor/extensions/qwaylandwlshell.cpp b/src/compositor/extensions/qwaylandwlshell.cpp
index 66aeb64ba..924234887 100644
--- a/src/compositor/extensions/qwaylandwlshell.cpp
+++ b/src/compositor/extensions/qwaylandwlshell.cpp
@@ -466,7 +466,8 @@ QWaylandWlShellSurface::QWaylandWlShellSurface(QWaylandWlShell *shell, QWaylandS
QWaylandWlShellSurface::~QWaylandWlShellSurface()
{
Q_D(QWaylandWlShellSurface);
- QWaylandWlShellPrivate::get(d->m_shell)->unregisterShellSurface(this);
+ if (d->m_shell)
+ QWaylandWlShellPrivate::get(d->m_shell)->unregisterShellSurface(this);
}
/*!