packages.flutter icon indicating copy to clipboard operation
packages.flutter copied to clipboard

Concurrent modification during iteration: Instance(length:0) of '_GrowableList'.

Open dkliss opened this issue 2 years ago • 1 comments

Describe the bug I have a list of pdf widget, which I am displaying in UI. In doing so, I received error Concurrent modification during iteration in library.

This is only seen in Android and not in iOS.

To reproduce, create a scrollable list of few pdfs and display as widgets.

Expected behaviour r This exception should not occur.

Screenshots Follow error is seen in Flutter.

I/flutter (19991): Concurrent modification during iteration: Instance(length:0) of '_GrowableList'. I/flutter (19991): #0 ListIterator.moveNext (dart:_internal/iterable.dart:336:7) I/flutter (19991): #1 _PdfViewPinchState._updatePageState (package:pdfx/src/viewer/pinch/pdf_view_pinch.dart:314:24) I/flutter (19991): I/flutter (19991): [log] [ERROR] [Main()] Concurrent modification during iteration: Instance(length:0) of '_GrowableList'., #0 ListIterator.moveNext (dart:_internal/iterable.dart:336:7) #1 _PdfViewPinchState._updatePageState (package:pdfx/src/viewer/pinch/pdf_view_pinch.dart:314:24)

Smartphone (please complete the following information):

  • Device: [e.g. iPhone12]
  • OS: [e.g. iOS15.4]

Additional context Add any other context about the problem here.

dkliss avatar Apr 22 '22 19:04 dkliss

I see this problem too (iOS, Android).

I suspect the widget was dispose()ed while _PdfViewPinchState._updatePageState() still has async work pending.

Caused by the user flipping very quickly between documents (not all of them pdfs) for me. Taking a copy of _PdfViewPinchState._pages at the start could help, but there may be other problems with work being done on torn-down data.

harry-dickson avatar Aug 29 '22 14:08 harry-dickson