Skip to content

[ios_platform_view] crash due to race when disposing platform views. #125223

@cyanglaz

Description

@cyanglaz

b/277154520

Actual Behavior
App crashes randomly when PlatformView is disposed while still in the composition order.

Expected behavior:
Engine needs to be resilient about this and not crash.

Reason:
It happens because views_to_dispose_ is populated on the ui thread but composition order is built on the main thread.
DisposeView happens before compositing the view tree. If a view is disposed but still in the composition_order, a NPE would happen during composition.

One solution could be to remove the disposed view from the composition order.

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread:  0

Application Specific Information:
abort() called


Last Exception Backtrace:
0   CoreFoundation                             0x19e0a7a84 __exceptionPreprocess + 
1   libobjc.A.dylib                            0x19c4f9958 objc_exception_throw + 
2   CoreFoundation                             0x19e235554 -[__NSCFString characterAtIndex:].cold.1 + 
3   CoreFoundation                             0x19e232388 -[__NSArrayM insertObject:atIndex:].cold.2 + 
4   CoreFoundation                             0x19e0b19d4 -[__NSArrayM insertObject:atIndex:] + 
5   Flutter                                    0x10cbe5498 flutter::IOSExternalViewEmbedder::SubmitFrame(GrDirectContext*, std::_LIBCPP_ABI_NAMESPACE::unique_ptr<flutter::SurfaceFrame, std::_LIBCPP_ABI_NAMESPACE::default_delete<flutter::SurfaceFrame>>) + 
6   Flutter                                    0x10cf8a918 flutter::Rasterizer::DrawToSurfaceUnsafe(flutter::FrameTimingsRecorder&, flutter::LayerTree&) + 
7   Flutter                                    0x10cf8ab70 std::_LIBCPP_ABI_NAMESPACE::__function::__func<flutter::Rasterizer::DrawToSurface(flutter::FrameTimingsRecorder&, flutter::LayerTree&)::$_1, std::_LIBCPP_ABI_NAMESPACE::allocator<flutter::Rasterizer::DrawToSurface(flutter::FrameTimingsRecorder&, flutter::LayerTree&)::$_1>, void ()>::operator()() + 
8   Flutter                                    0x10ce9218c fml::SyncSwitch::Execute(fml::SyncSwitch::Handlers const&) const + 
9   Flutter                                    0x10cf8a2a8 flutter::Rasterizer::DrawToSurface(flutter::FrameTimingsRecorder&, flutter::LayerTree&) + 

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listcustomer: quake (g3)engineflutter/engine related. See also e: labels.platform-iosiOS applications specifically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions