backends/drm: don't crash if importing a texture fails
CCBUG: 456500
This commit is contained in:
parent
c8c1b05661
commit
636b411b31
1 changed files with 8 additions and 1 deletions
|
@ -647,7 +647,14 @@ std::shared_ptr<DmaBufTexture> DrmBackend::createDmaBufTexture(const QSize &size
|
||||||
gbm_bo_destroy(bo);
|
gbm_bo_destroy(bo);
|
||||||
const auto eglBackend = static_cast<EglGbmBackend *>(m_renderBackend);
|
const auto eglBackend = static_cast<EglGbmBackend *>(m_renderBackend);
|
||||||
eglBackend->makeCurrent();
|
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
|
DrmGpu *DrmBackend::primaryGpu() const
|
||||||
|
|
Loading…
Reference in a new issue