I didn't get a reply to my last email so I'm trying here: after Thomas Tempelmann convinced me to try with the diagnosis in a thread everything seemed to be fine.
Then I got the first report from a customer: when you switch to another app when the diagnosis is running then macOS redraws the windows, which reloads the data in the main window. Which then crashes due to the running diagnosis. I think I fixed that by doing a semaphore on the reloading of the data. Of course, in this case part of the data in the window disappears because the NSTableView doesn't cache the data.
So far so good. Then yesterday I got another crash report. My app now crashes when the app is quit during diagnosis.
Thread 0:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff609a2202 close + 10
1 com.apple.CoreServices.CarbonCore 0x00007fff35b9059c BasicCloseFork(int) + 44
2 com.apple.CoreServices.CarbonCore 0x00007fff35b90564 PBCloseForkSync + 17
3 com.apple.CoreServices.CarbonCore 0x00007fff35b90547 FSCloseFork + 29
4 libvshared_fat_release_x64.dylib 0x000000010eba1d64 fbl::File_Mac:oClose() + 40
5 libvkernel_fat_release_x64.dylib 0x000000010fa8fba9 fbl:bStorage::CloseVolumes() + 93
6 libvkernel_fat_release_x64.dylib 0x000000010f85afbd fbl:atabase_imp::Close() + 281
7 libvkernel_fat_release_x64.dylib 0x000000010f84fc3e fbl::vsql::SqlDatabase::Close() + 334
8 v4rb_cocoa_64.dylib 0x000000010eaa625a Database_Close(REALobjectStruct*) + 94
9 com.mothsoftware.mailarchiverx 0x0000000104857dbf VDatabase.Close%%o<VDatabase> + 31
10 com.mothsoftware.mailarchiverx 0x0000000104e4584b VConnectionController.Disconnect%%o<VConnectionController> + 747
11 com.mothsoftware.mailarchiverx 0x00000001055b99ae MaxModel.CloseArchive%%o<MaxModel> + 510
12 com.mothsoftware.mailarchiverx 0x0000000105ca3bb4 MainWindowController.CloseArchive%%o<MainWindowController> + 212
13 com.mothsoftware.mailarchiverx 0x0000000105ce03fb MainWindow.MainWindow.CloseDB%%o<MainWindow.MainWindow>b + 3915
14 com.mothsoftware.mailarchiverx 0x0000000105ccbe7e MainWindow.MainWindow.Event_CloseDatabase%%o<MainWindow.MainWindow>b + 270
15 com.mothsoftware.mailarchiverx 0x0000000105d5490a DBWindow.CloseArchive%%o<DBWindow> + 474
Thread 11 Crashed:
0 libvkernel_fat_release_x64.dylib 0x000000010faa03ac fbl::SegmentFile::ReadSegmentHeader(unsigned int, fbl::SegmentHeader& + 52
1 libvkernel_fat_release_x64.dylib 0x000000010fa9f85c fbl::SegmentFile:iagnose_ChainOfSegments(fbl::smart_ptr<fbl::I_OStream>, fbl::EVerboseLevel, unsigned int, fbl::BitSet& + 166
2 libvkernel_fat_release_x64.dylib 0x000000010fa9f670 fbl::SegmentFile:iagnose(fbl::smart_ptr<fbl::I_OStream>, fbl::EVerboseLevel, fbl::smart_ptr<fbl::BitSet> + 420
3 libvkernel_fat_release_x64.dylib 0x000000010f796297 fbl::VBlob:iagnoseWithExplain(fbl::smart_ptr<fbl::I_OStream>, fbl::EVerboseLevel, fbl::smart_ptr<fbl::Node_Explain> + 1383
4 libvkernel_fat_release_x64.dylib 0x000000010fab56fa fbl::Table:iagnoseWithExplain(fbl::smart_ptr<fbl::I_OStream>, fbl::EVerboseLevel, fbl::smart_ptr<fbl::Node_Explain> + 1098
5 libvkernel_fat_release_x64.dylib 0x000000010f85795b fbl:atabase_imp:iagnose_plain_imp(fbl::smart_ptr<fbl::I_OStream>, fbl::EVerboseLevel, fbl::smart_ptr<fbl::Node_Explain> + 195
6 libvkernel_fat_release_x64.dylib 0x000000010f86b64a fbl:atabase_imp:iagnoseWithExplain_imp(fbl::smart_ptr<fbl::I_OStream>, fbl::EVerboseLevel, fbl::smart_ptr<fbl::Node_Explain> + 1104
7 libvkernel_fat_release_x64.dylib 0x000000010f86aea9 fbl:atabase_imp:iagnoseWithExplain(fbl::smart_ptr<fbl::I_OStream>, fbl::EVerboseLevel, fbl::smart_ptr<fbl::Node_Explain> + 99
8 libvkernel_fat_release_x64.dylib 0x000000010f86b09f fbl:atabase_imp:iagnoseWithExplain(fbl::smart_ptr<fbl::I_Location>, fbl::EVerboseLevel, fbl::smart_ptr<fbl::Node_Explain> + 405
9 libvkernel_fat_release_x64.dylib 0x000000010f85c5b5 fbl:atabase_imp:iagnose(fbl::smart_ptr<fbl::I_Location>, fbl::EVerboseLevel) + 71
10 v4rb_cocoa_64.dylib 0x000000010eaacfa9 Database_Diagnose(REALobjectStruct*, int, REALobjectStruct*) + 299
11 com.mothsoftware.mailarchiverx 0x000000010485a6ea VDatabase.Diagnose%b%o<VDatabase>i8o<FolderItem> + 74
12 com.mothsoftware.mailarchiverx 0x0000000104b0aadc DiagnoseThread.Event_Run%%o<DiagnoseThread> + 972
13 com.xojo.XojoFramework 0x00000001077fe860 0x107587000 + 2586720
I have a really bad feeling about the situation with the diagnosis. A couple of times I thought "now I've got it" - just to see another hole that I need to plug.
The whole architecture doesn't work. The app is async and the database is not. That doesn't fit together.
Mit freundlichen Grüßen/Regards
Beatrix Willius
http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals