I create Thumbnails of PDFs in multiple Asynctasks.
I present the PDFs in a Gridview inside a Scrollview.
I render only the PDFs that are currently visible( using the getView function)
That means, that i have to cancel the tasks, if a view is not visible anymore on the SCrenn (recycled or whatever)
To do this i cancel the asynctask but i check "ifCanceled()" during the operations.
If i fling through the list i am spawning new Tasks and cancel them acordingly.
Sometimes if i fling through the list i get a fatal error indicating, that the renderToBmp() function is using a fault adress (so i guess it is accessing memory that is already freed).
This only happens with directories with ca 500 files (as i have tested so far) and excessive scrolling.
I cant catch the error, because it is only one command: renderToBmp
If you need a Video or the code, let me know, i tried everything but i assume the following:
"The task is spawned and working
rendertobmp is called,
the task is canceled
Because the is no reference anymore to the task, the system gc.
the bitmap is freed and rendertoBmp is calling a fault address.