backends/drm: fix crash in aboutToStartPainting

m_gbmSurface may still be nullptr
This commit is contained in:
Xaver Hugl 2022-02-19 05:34:24 +01:00
parent 0cd453690b
commit 36088cc82c
2 changed files with 2 additions and 2 deletions

View file

@ -123,7 +123,7 @@ std::optional<QRegion> EglGbmLayer::startRendering()
void EglGbmLayer::aboutToStartPainting(const QRegion &damagedRegion)
{
if (m_gbmSurface->bufferAge() > 0 && !damagedRegion.isEmpty() && m_eglBackend->supportsPartialUpdate()) {
if (m_gbmSurface && m_gbmSurface->bufferAge() > 0 && !damagedRegion.isEmpty() && m_eglBackend->supportsPartialUpdate()) {
QVector<EGLint> rects = m_pipeline->output()->regionToRects(damagedRegion);
const bool correct = eglSetDamageRegionKHR(m_eglBackend->eglDisplay(), m_gbmSurface->eglSurface(), rects.data(), rects.count() / 4);
if (!correct) {

View file

@ -50,7 +50,7 @@ void VirtualEglGbmLayer::destroyResources()
void VirtualEglGbmLayer::aboutToStartPainting(const QRegion &damagedRegion)
{
if (m_gbmSurface->bufferAge() > 0 && !damagedRegion.isEmpty() && m_eglBackend->supportsPartialUpdate()) {
if (m_gbmSurface && m_gbmSurface->bufferAge() > 0 && !damagedRegion.isEmpty() && m_eglBackend->supportsPartialUpdate()) {
const QRegion region = damagedRegion & m_output->geometry();
QVector<EGLint> rects = m_output->regionToRects(region);