This happens only with SlicerCAT (clean Slicer app works fine) even when all the modules are disabled ie SlicerCAT is launched with --disable-modules
Here are the steps that leads to this:
launch SlicerCAT
open Application Settings
close Application Settings
close SlicerCAT
It seems that this->SettingsDialog is already somehow unavailable by the time setting setParent(nullptr)
I’ve tried to rebuild it, debug but without success. Even though the idea behind creating/deleting SettingsDialog is pretty clear.
If somebody uses SlicerCAT with recent commits (after 26 february) I would appreciate for testing that.
But what if ~MainWindow destructor is called before ~qSlicerApplicationPrivate destructor? Then in ~qSlicerApplicationPrivate we will try to access deleted Settings object.
I added cout to these destructors to see who is deleted first and the output is:
$ ./Colada --disable-modules
QXcbConnection: XCB error: 3 (BadWindow), sequence: 1157, resource id: 14779307, major code: 40 (TranslateCoords), minor code: 0
MainWindow destructor is called
Switch to module: ""
qSlicerApplicationPrivate destructor is called
error: [~/Documents/Colada/d/Slicer-build/bin/./ColadaApp-real] exit abnormally - Report the problem.
That means in my SlicerCAT (I suspect in others too) ~MainWindow is deleted first so there is no need to explicitely delete Settings in ~qSlicerApplicationPrivate destructor.
The same issue is solved for the Python console, by using a QPointer. It would be great if you could submit a pull request that passes the ownership of the settings dialog similarly to how it is done for the Python console.
Could please show where can I find Python console QPointer solution?
I have an idea how to solve this with QPointer but don’t know anything about python console implementation yet.