ScerIO / packages.flutter

👨‍💻 Plugins and packages for Flutter framework
https://pub.dev/publishers/serge.software/packages
MIT License
462 stars 456 forks source link

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

Open dkliss opened 2 years ago

dkliss commented 2 years ago

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.
harry-dickson commented 2 years ago

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.