Weird behavior at application startup - "QObject: Cannot create children for parent that is in a different thread" but there is just one thread - promise!
-
wrote on 4 Sept 2015, 08:36 last edited by
Hello,
colleague of mine got some strange behavior at application startup.
He has a Object derived from QCoreApplication (- lets call it MyApp) and tries to instantiate a child object in with MyApp as a parent. Doing this results in the above-named warning - but there is no other thread than the main thread in the process - i've checked it. Twice!Any idea about this?
Cheers, -
Hi @ttuna,
May I ask why you are deriving from QCoreApplication?
-
wrote on 4 Sept 2015, 12:35 last edited by
Because we like to have a clean interface and want to avoid tons of code in main().
We've done this in several projects before and never got problems with it. -
Hi,
What exactly are you creating there ?
-
wrote on 5 Sept 2015, 00:35 last edited by
You need to show some code.
Was QCoreApplication constructor called?
You might get such effect if it was not or other QObjects were instantiated before QCoreApplication was constructed.
5/5