Hello all
Synopsis: document based SwiftData app breaks document handling after first save due to internal error saving the -shm file.
Long: i am working on a small document based SwiftData app for macOS. The UI works well as long as the document was not saved. After saving the document and reopening it, I get an error consistently in console:
BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode unlinked while in use: /Users/vrunkel/Library/Containers/de.ecoobs.CurtailmentAnalyzer/Data/tmp/TemporaryItems/NSIRD_CurtailmentAnalyzer_mrXKMs/NewDocument/StoreContent-shm
So somehow the -shm file is still referenced to NewDocument created when the app opens an untitled document and resides in the temporary folder. I have saved the document to my documents folder.
After reopening and the above error deletion or addition of items crashes the app with a long backtrace to view updating:
Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.
I am not creating any threads or do background work. If I do not save the document but work within the new untitled document no problems occur. Even closing the app and reopening the untitled new doc (happens automatically) all is fine.
To rule out any influence of my existing view structure I have created the most simple test case - Xcode -> New Project -> macOS document based app configured to use SwiftData.
Same behaviour. After saving a new document the addition/deletion of items causes the thread-induced crash and shows the error in console when opening the document.
I am using latest versions of Xcode 15.0 and macOS 14.0
Any ideas?
thx, volker