Fix a potential SIGSEGV

Compositor::self()->scene() may return nullptr while compositing is
being restarted.
This commit is contained in:
Vlad Zahorodnii 2020-10-16 19:30:37 +03:00
parent cc8cb8db9d
commit da12d3804f

View file

@ -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;
}