Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Weird behavior at application startup - "QObject: Cannot create children for parent that is in a different thread" but there is just one thread - promise!
QtWS25 Last Chance

Weird behavior at application startup - "QObject: Cannot create children for parent that is in a different thread" but there is just one thread - promise!

Scheduled Pinned Locked Moved General and Desktop
qthreadqcoreapplicatio
5 Posts 4 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    ttuna
    wrote on last edited by
    #1

    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,

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi @ttuna,

      May I ask why you are deriving from QCoreApplication?

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • T Offline
        T Offline
        ttuna
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          What exactly are you creating there ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • A Offline
            A Offline
            alex_malyu
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved