• 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.dart Loading commit data...
basic_types.dart Loading commit data...
beveled_rectangle_border.dart Loading commit data...
binding.dart Loading commit data...
border_radius.dart Loading commit data...
borders.dart Loading commit data...
box_border.dart Loading commit data...
box_decoration.dart Loading commit data...
box_fit.dart Loading commit data...
box_shadow.dart Loading commit data...
circle_border.dart Loading commit data...
clip.dart Loading commit data...
colors.dart Loading commit data...
continuous_rectangle_border.dart Loading commit data...
debug.dart Loading commit data...
decoration.dart Loading commit data...
decoration_image.dart Loading commit data...
edge_insets.dart Loading commit data...
flutter_logo.dart Loading commit data...
fractional_offset.dart Loading commit data...
geometry.dart Loading commit data...
gradient.dart Loading commit data...
image_cache.dart Loading commit data...
image_decoder.dart Loading commit data...
image_provider.dart Loading commit data...
image_resolution.dart Loading commit data...
image_stream.dart Loading commit data...
matrix_utils.dart Loading commit data...
notched_shapes.dart Loading commit data...
paint_utilities.dart Loading commit data...
rounded_rectangle_border.dart Loading commit data...
shader_warm_up.dart Loading commit data...
shape_decoration.dart Loading commit data...
stadium_border.dart Loading commit data...
strut_style.dart Loading commit data...
text_painter.dart Loading commit data...
text_span.dart Loading commit data...
text_style.dart Loading commit data...