Bug 1827050 - Check if TextureOwner exists before DUMMY_TEXTURE check r=lsalzman

TextureOwner check needs to be done before DUMMY_TEXTURE check.

Crash happened because remoteTexture was nullptr in RemoteTextureMap::GetExternalImageIdOfRemoteTexture(). The remoteTexture was nullptr , since TextureOwner was already unregistered.

Differential Revision: https://phabricator.services.mozilla.com/D175087
This commit is contained in:
sotaro 2023-04-11 03:04:02 +00:00
Родитель 6c33422360
Коммит 60dadf4f06
1 изменённых файлов: 9 добавлений и 5 удалений

Просмотреть файл

@ -640,11 +640,6 @@ wr::MaybeExternalImageId RemoteTextureMap::GetExternalImageIdOfRemoteTexture(
}
TextureHost* remoteTexture = it->second->mAsyncRemoteTextureHost;
if (remoteTexture->GetFlags() & TextureFlags::DUMMY_TEXTURE) {
// Remote texture allocation was failed.
return Nothing();
}
MOZ_ASSERT(!(remoteTexture->GetFlags() & TextureFlags::DUMMY_TEXTURE));
auto* owner = GetTextureOwner(lock, aOwnerId, aForPid);
if (!owner) {
@ -654,6 +649,15 @@ wr::MaybeExternalImageId RemoteTextureMap::GetExternalImageIdOfRemoteTexture(
}
return remoteTexture->GetMaybeExternalImageId();
}
if (remoteTexture &&
remoteTexture->GetFlags() & TextureFlags::DUMMY_TEXTURE) {
// Remote texture allocation was failed.
return Nothing();
}
MOZ_ASSERT(!(remoteTexture &&
remoteTexture->GetFlags() & TextureFlags::DUMMY_TEXTURE));
MOZ_ASSERT(owner);
if (!remoteTexture) {