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

Commit 273fdf0

Browse files
committed
Fix potential null-point references
1 parent d721647 commit 273fdf0

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: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "flutter/impeller/renderer/context.h"
1616
#include "flutter/impeller/renderer/texture.h"
1717
#include "flutter/lib/ui/painting/image_decoder_skia.h"
18+
#include "fml/logging.h"
1819
#include "impeller/base/strings.h"
1920
#include "impeller/geometry/size.h"
2021
#include "include/core/SkSize.h"
@@ -179,20 +180,19 @@ sk_sp<DlImage> ImageDecoderImpeller::UploadTexture(
179180

180181
{
181182
auto command_buffer = context->CreateCommandBuffer();
182-
command_buffer->SetLabel("Mipmap Command Buffer");
183183
if (!command_buffer) {
184184
FML_DLOG(ERROR)
185185
<< "Could not create command buffer for mipmap generation.";
186186
return nullptr;
187187
}
188+
command_buffer->SetLabel("Mipmap Command Buffer");
188189

189190
auto blit_pass = command_buffer->CreateBlitPass();
190-
blit_pass->SetLabel("Mipmap Blit Pass");
191191
if (!blit_pass) {
192192
FML_DLOG(ERROR) << "Could not create blit pass for mipmap generation.";
193193
return nullptr;
194194
}
195-
195+
blit_pass->SetLabel("Mipmap Blit Pass");
196196
blit_pass->GenerateMipmap(texture);
197197

198198
blit_pass->EncodeCommands(context->GetResourceAllocator());
@@ -233,6 +233,7 @@ void ImageDecoderImpeller::Decode(fml::RefPtr<ImageDescriptor> descriptor,
233233
io_runner = runners_.GetIOTaskRunner(), //
234234
result //
235235
]() {
236+
FML_CHECK(context) << "No valid impeller context";
236237
auto max_size_supported =
237238
context->GetResourceAllocator()->GetMaxTextureSizeSupported();
238239

shell/platform/android/android_surface_vulkan_impeller.cc

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

119+
std::shared_ptr<impeller::Context> AndroidSurfaceVulkanImpeller::GetImpellerContext() {
120+
return impeller_context_;
121+
}
122+
119123
} // 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)