Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Memory leak #84

Open
omkartralsawala opened this issue Sep 11, 2021 · 0 comments
Open

Memory leak #84

omkartralsawala opened this issue Sep 11, 2021 · 0 comments

Comments

@omkartralsawala
Copy link

I am using advance_pdf_viewer in my flutter app and am getting the following error regarding a memory leak

Please look into it!!

W/System (12561): A resource failed to call close.
════════ Exception caught by image resource service ════════════════════════════
The following assertion was thrown by an image listener:
setState() called after dispose(): _PDFPageState#a30fd(lifecycle state: defunct, not mounted)

This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback.

The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in the tree.
This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose().

When the exception was thrown, this was the stack
#0 State.setState.
#1 State.setState
#2 _PDFPageState._repaint.
#3 ImageStreamCompleter.setImage
#4 MultiFrameImageStreamCompleter._emitFrame
...
════════════════════════════════════════════════════════════════════════════════

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant