on iOS, bug fixed when deleting task concurrently #637
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On iOS, when a running or enqueued task is deleting,it may be executed concurrently on main thread and thread that database queue
vn.hunghd.flutter_downloader
dispatched,it may cause thatexecuteQueryResults
returns nonSQLITE_DONE(101)
in codeint executeQueryResults = sqlite3_step(compiledStatement)
,finally, failed, the task is not removed from database actually.For example, 12 tasks try to be removed in a for loop, but only 9 tasks are SQLITE_DONE.
![screenshot](https://user-images.githubusercontent.com/66350348/168055117-7f8ec929-1614-44d5-9923-4972cd0660b7.png)

I'm not sure if there's the case in other code, I haven't come across it yet.