The problem arises because before creating a QApplication, you touch the Qt API (in the main thread or only in some thread). You cannot do this. In particular, you create some kind of QObject that defines somwhere in Qt, which Qt itself should consider as the main thread.
The only Qt APIs you allowed to use before creating QApplication are those that are explicitly documented for security in this scenario.
So: do not do this. Create a QCoreApplication as the first thing , then you can freely.
peppe source share