未验证 提交 919e3532 编写于 作者: C Chinmay Garde 提交者: GitHub

Only release the image data in the unit-test once Skia has accepted ownership of it. (#9816)

Fixes UB which caused failures on Windows on the unit-test run.
上级 b42450f2
......@@ -91,9 +91,16 @@ static sk_sp<SkData> OpenFixtureAsSkData(const char* name) {
delete reinterpret_cast<fml::FileMapping*>(context);
};
return SkData::MakeWithProc(fixture_mapping->GetMapping(),
fixture_mapping->GetSize(), on_release,
fixture_mapping.release());
auto data = SkData::MakeWithProc(fixture_mapping->GetMapping(),
fixture_mapping->GetSize(), on_release,
fixture_mapping.get());
if (!data) {
return nullptr;
}
// The data is now owned by Skia.
fixture_mapping.release();
return data;
}
TEST_F(ImageDecoderFixtureTest, CanCreateImageDecoder) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册