Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c5e6a38

Browse files
authored
Fix potential null-point references (#37678)
1 parent d7f49f6 commit c5e6a38

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

impeller/renderer/backend/vulkan/command_buffer_vk.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ std::shared_ptr<RenderPass> CommandBufferVK::OnCreateRenderPass(
129129
}
130130

131131
std::shared_ptr<BlitPass> CommandBufferVK::OnCreateBlitPass() const {
132-
FML_UNREACHABLE();
132+
// TODO(kaushikiska): https://github.com/flutter/flutter/issues/112649
133+
return nullptr;
133134
}
134135

135136
std::shared_ptr<ComputePass> CommandBufferVK::OnCreateComputePass() const {

lib/ui/painting/image_decoder_impeller.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,20 +179,19 @@ sk_sp<DlImage> ImageDecoderImpeller::UploadTexture(
179179

180180
{
181181
auto command_buffer = context->CreateCommandBuffer();
182-
command_buffer->SetLabel("Mipmap Command Buffer");
183182
if (!command_buffer) {
184183
FML_DLOG(ERROR)
185184
<< "Could not create command buffer for mipmap generation.";
186185
return nullptr;
187186
}
187+
command_buffer->SetLabel("Mipmap Command Buffer");
188188

189189
auto blit_pass = command_buffer->CreateBlitPass();
190-
blit_pass->SetLabel("Mipmap Blit Pass");
191190
if (!blit_pass) {
192191
FML_DLOG(ERROR) << "Could not create blit pass for mipmap generation.";
193192
return nullptr;
194193
}
195-
194+
blit_pass->SetLabel("Mipmap Blit Pass");
196195
blit_pass->GenerateMipmap(texture);
197196

198197
blit_pass->EncodeCommands(context->GetResourceAllocator());
@@ -233,6 +232,7 @@ void ImageDecoderImpeller::Decode(fml::RefPtr<ImageDescriptor> descriptor,
233232
io_runner = runners_.GetIOTaskRunner(), //
234233
result //
235234
]() {
235+
FML_CHECK(context) << "No valid impeller context";
236236
auto max_size_supported =
237237
context->GetResourceAllocator()->GetMaxTextureSizeSupported();
238238

shell/platform/android/android_surface_vulkan_impeller.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,9 @@ bool AndroidSurfaceVulkanImpeller::SetNativeWindow(
116116
return false;
117117
}
118118

119+
std::shared_ptr<impeller::Context>
120+
AndroidSurfaceVulkanImpeller::GetImpellerContext() {
121+
return impeller_context_;
122+
}
123+
119124
} // namespace flutter

shell/platform/android/android_surface_vulkan_impeller.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ class AndroidSurfaceVulkanImpeller : public AndroidSurface {
4040
// |AndroidSurface|
4141
bool ResourceContextClearCurrent() override;
4242

43+
// |AndroidSurface|
44+
std::shared_ptr<impeller::Context> GetImpellerContext() override;
45+
4346
// |AndroidSurface|
4447
bool SetNativeWindow(fml::RefPtr<AndroidNativeWindow> window) override;
4548

0 commit comments

Comments
 (0)