Commit ee1c68e9 authored by Xaver Hugl's avatar Xaver Hugl
Browse files

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

CCBUG: 456500
(cherry picked from commit 636b411b)
parent 92866c98
Pipeline #205708 passed with stage
in 34 minutes and 38 seconds
......@@ -654,7 +654,15 @@ QSharedPointer<DmaBufTexture> DrmBackend::createDmaBufTexture(const QSize &size)
const DmaBufAttributes attributes = dmaBufAttributesForBo(bo);
gbm_bo_destroy(bo);
return QSharedPointer<DmaBufTexture>::create(eglBackend->importDmaBufAsTexture(attributes), attributes);
auto texture = eglBackend->importDmaBufAsTexture(attributes);
if (texture) {
return QSharedPointer<DmaBufTexture>::create(texture, attributes);
} else {
for (int i = 0; i < attributes.planeCount; ++i) {
::close(attributes.fd[i]);
}
return nullptr;
}
} else {
return nullptr;
}
......
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