Skip to content

Commit 4d8773c

Browse files
committed
[Impeller] Don't crash if the context is unavailable.
Fixes flutter/flutter#123027. Turns out, this isn't an issue with back-grounding. This can only happen if the IO manager is torn down before worker pool has had a chance to process the decompression job, or if the UI manager was never setup. It is hard to imaging how this could happen in a real application. If it does though, we should not crash. This patch makes the change to return an error instead. The linked issue was a test environment and the failure was addressed in flutter#40535.
1 parent 33fa6eb commit 4d8773c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/ui/painting/image_decoder_impeller.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,10 @@ void ImageDecoderImpeller::Decode(fml::RefPtr<ImageDescriptor> descriptor,
406406
result,
407407
supports_wide_gamut = supports_wide_gamut_ //
408408
]() {
409-
FML_CHECK(context) << "No valid impeller context";
409+
if (!context) {
410+
result(nullptr);
411+
return;
412+
}
410413
auto max_size_supported =
411414
context->GetResourceAllocator()->GetMaxTextureSizeSupported();
412415

0 commit comments

Comments
 (0)