From da12d3804f1a37d28333a7728a22e91cbf44ecc0 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 16 Oct 2020 19:30:37 +0300 Subject: [PATCH] Fix a potential SIGSEGV Compositor::self()->scene() may return nullptr while compositing is being restarted. --- platform.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platform.cpp b/platform.cpp index e001c4e288..a9e3cd6697 100644 --- a/platform.cpp +++ b/platform.cpp @@ -415,8 +415,12 @@ void Platform::warpPointer(const QPointF &globalPos) bool Platform::supportsSurfacelessContext() const { - if (Compositor *c = Compositor::self()) { - return c->scene()->supportsSurfacelessContext(); + Compositor *compositor = Compositor::self(); + if (Q_UNLIKELY(!compositor)) { + return false; + } + if (Scene *scene = compositor->scene()) { + return scene->supportsSurfacelessContext(); } return false; }