• Amir Hardon's avatar
    Make sure _handleAppFrame is only registered once per frame (#30346) · b6afc16a
    Amir Hardon authored
    There were 2 possible scenarios in which _handleAppFrame is added more than once as a frame callback. When this happens it is possible that the second invocation will try to access _nextFrame.image when _nextFrame is null and crash. The 2 scenarios are:
    
    Scenario 1
    
    A GIF frame is decoded and a Flutter frame is executed before it's time to show the next GIF frame.
    The timer that's waiting for enough time to elapse is invoked, and schedules a callback for the next Flutter frame(here).
    Before the next Flutter frame is executed, MultiFrameImageStreamCompleter#removeListener is called followed by ``MultiFrameImageStreamCompleter#addListenerthat is invoking_decodeNextFrameAndSchedule` which is adding `_handleAppFrame` again as a next frame callback.
    Scenario 2
    removeListener and addListener are called multiple times in succession, every call to addListener can result in another registration of _handleAppFrame to the next Flutter frame callbacks list.
    
    This patch fixes the issue by guarding against a second registration of _handleAppFrame.
    b6afc16a
Name
Last commit
Last update
..
alignment_test.dart Loading commit data...
beveled_rectangle_border_test.dart Loading commit data...
binding_test.dart Loading commit data...
border_radius_test.dart Loading commit data...
border_rtl_test.dart Loading commit data...
border_side_test.dart Loading commit data...
border_test.dart Loading commit data...
box_decoration_test.dart Loading commit data...
box_fit_test.dart Loading commit data...
box_painter_test.dart Loading commit data...
circle_border_test.dart Loading commit data...
colors_test.dart Loading commit data...
common_matchers.dart Loading commit data...
continous_rectangle_border_test.dart Loading commit data...
decoration_test.dart Loading commit data...
edge_insets_test.dart Loading commit data...
fake_codec.dart Loading commit data...
fake_image_provider.dart Loading commit data...
flutter_logo_test.dart Loading commit data...
fractional_offset_test.dart Loading commit data...
geometry_test.dart Loading commit data...
gradient_test.dart Loading commit data...
image_cache_resize_test.dart Loading commit data...
image_cache_test.dart Loading commit data...
image_data.dart Loading commit data...
image_decoder_test.dart Loading commit data...
image_provider_test.dart Loading commit data...
image_resolution_test.dart Loading commit data...
image_stream_test.dart Loading commit data...
image_test_utils.dart Loading commit data...
matrix_utils_test.dart Loading commit data...
mocks_for_image_cache.dart Loading commit data...
notched_shapes_test.dart Loading commit data...
paint_image_test.dart Loading commit data...
painting_utils.dart Loading commit data...
rounded_rectangle_border_test.dart Loading commit data...
shape_border_test.dart Loading commit data...
shape_decoration_test.dart Loading commit data...
stadium_border_test.dart Loading commit data...
text_painter_rtl_test.dart Loading commit data...
text_painter_test.dart Loading commit data...
text_span_test.dart Loading commit data...
text_style_test.dart Loading commit data...