Weird security error on macOS when restarting under lldb, sometimes

I keep getting this error randomly every few times I restart Slicer under lldb. The first run after launching lldb always works, but if I relaunch in the same lldb process (proc launch), then I get this anywhere from the 2nd to maybe maximum 10th run. I use lldb like this very often, but have never seen such an error before…

Has anyone else seen this?

(lldb) proc lau
...
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = c++ exception
  * frame #0: 0x00007fffc0002450 libc++abi.dylib`__cxa_allocate_exception
    frame #1: 0x00007fffb213848a Security`Security::MacOSError::throwMe(int) + 20
    frame #2: 0x00007fffb2018673 Security`Security::CodeSigning::SecStaticCode::signature() + 87
    frame #3: 0x00007fffb2018953 Security`Security::CodeSigning::SecStaticCode::verifySignature() + 135
    frame #4: 0x00007fffb20186d0 Security`Security::CodeSigning::SecStaticCode::validateDirectory() + 92
    frame #5: 0x00007fffb201925b Security`Security::CodeSigning::SecStaticCode::validateNonResourceComponents() + 15
    frame #6: 0x00007fffb200d309 Security`Security::CodeSigning::SecCode::checkValidity(unsigned int) + 205
    frame #7: 0x00007fffb2011710 Security`SecCodeCheckValidityWithErrors + 59
    frame #8: 0x000000010441b507 QtCore`QSettingsPrivate::create(QSettings::Format, QSettings::Scope, QString const&, QString const&) + 139
    frame #9: 0x0000000104401af8 QtCore`QSettings::QSettings(QSettings::Scope, QString const&, QString const&, QObject*) + 20
    frame #10: 0x0000000104421fd0 QtCore`QFactoryLoader::update() + 94
    frame #11: 0x0000000104421dcc QtCore`QFactoryLoader::QFactoryLoader(char const*, QString const&, Qt::CaseSensitivity) + 216
    frame #12: 0x00000001038b893d QtGui`loaderV2() + 94
    frame #13: 0x00000001038b80ec QtGui`QIcon::addFile(QString const&, QSize const&, QIcon::Mode, QIcon::State) + 112
    frame #14: 0x00000001038b845c QtGui`QIcon::QIcon(QString const&) + 40
    frame #15: 0x0000000100de3e2e libCTKScriptingPythonWidgets.0.1.dylib`ctkPythonConsole::ctkPythonConsole(this=0x000000011ccce3e0, parentObject=0x0000000000000000) at ctkPythonConsole.cpp:534
    frame #16: 0x0000000100de40ad libCTKScriptingPythonWidgets.0.1.dylib`ctkPythonConsole::ctkPythonConsole(this=0x000000011ccce3e0, parentObject=0x0000000000000000) at ctkPythonConsole.cpp:532
    frame #17: 0x00000001004dc76f libqSlicerBaseQTGUI.dylib`qSlicerApplicationPrivate::init(this=0x000000011cc9d660) at qSlicerApplication.cxx:190
    frame #18: 0x00000001004de9ac libqSlicerBaseQTGUI.dylib`qSlicerApplication::qSlicerApplication(this=0x00007fff5fbff498, _argc=0x00007fff5fbff540, _argv=0x00007fff5fbff648) at qSlicerApplication.cxx:351
    frame #19: 0x00000001004debb5 libqSlicerBaseQTGUI.dylib`qSlicerApplication::qSlicerApplication(this=0x00007fff5fbff498, _argc=0x00007fff5fbff540, _argv=0x00007fff5fbff648) at qSlicerApplication.cxx:349
    frame #20: 0x000000010003ab39 Slicer`(anonymous namespace)::SlicerAppMain(argc=10, argv=0x00007fff5fbff648) at Main.cxx:141
    frame #21: 0x000000010003a672 Slicer`main(argc=10, argv=0x00007fff5fbff648) at Main.cxx:302
    frame #22: 0x00007fffc13f9235 libdyld.dylib`start + 1
    frame #23: 0x00007fffc13f9235 libdyld.dylib`start + 1

Very weird - looks like an OS bug, like maybe a race condition? It seems to be happening while opening your settings file. Launching again after the crash works?

Is it Qt4 or Qt5? Have you built Qt yourself? Are the binaries signed?

[edit] re-launching again in the same process? Good point - not sure.

Qt4 from Homebrew, not signed as far as I know.

It’s not a huge issue, just really weird. Maybe Apple is mad because I keep ignoring update notices :laughing:.