Commit 636b411b authored by Xaver Hugl's avatar Xaver Hugl
Browse files

backends/drm: don't crash if importing a texture fails

CCBUG: 456500
parent c8c1b056
Pipeline #205691 passed with stage
in 27 minutes and 44 seconds
......@@ -647,7 +647,14 @@ std::shared_ptr<DmaBufTexture> DrmBackend::createDmaBufTexture(const QSize &size
gbm_bo_destroy(bo);
const auto eglBackend = static_cast<EglGbmBackend *>(m_renderBackend);
eglBackend->makeCurrent();
return std::make_shared<DmaBufTexture>(eglBackend->importDmaBufAsTexture(attributes), attributes);
if (auto texture = eglBackend->importDmaBufAsTexture(attributes)) {
return std::make_shared<DmaBufTexture>(texture, attributes);
} else {
for (int i = 0; i < attributes.planeCount; ++i) {
::close(attributes.fd[i]);
}
return nullptr;
}
}
DrmGpu *DrmBackend::primaryGpu() const
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment