vdhamer / Photo-Club-Hub

iOS app for showcasing and viewing portfolios with curated fine-art photographic images.
MIT License
13 stars 1 forks source link

Fix swipe-down crash #443

Open vdhamer opened 3 months ago

vdhamer commented 3 months ago

Swiping down currently does 2 things:

  1. Deletes the content of the database
  2. Reloads the content of the database

When adding #1, the crash started showing up. It is CoreData complaining about mixing threads aka contexts. Probably not a data race issue, because Swift 6 doesn’t have any warnings. Seems to happen if swiping down takes place during either reloading or before prev deletion finishes.

Questions: ? Does crash go away when compiling for Swift 6 (unlikely, but maybe error message is more specific) ? ? Does it happen when deletion and reloading occur simultaneously ? ? Under what thread is deletion done anyway ? Reloading is done on multiple background threads. ? Any pattern visible in when it happens ? Doesn’t seen to crash if everything has completed before swipe.