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. QtConcurrent::run children warning
Forum Updated to NodeBB v4.3 + New Features

QtConcurrent::run children warning

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 533 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.
  • K Offline
    K Offline
    Kaluss
    wrote on last edited by Kaluss
    #1

    Hi,
    I got following problem during my code execution:
    When I run function via QtConcurrent::run where I got:

       QProcess unpackProcess( this );
    
       unpackProcess.start( "powershell ", args );
    

    I get debug message:
    QObject: Cannot create children for a parent that is in a different thread.
    (Parent is InvSystem::AppUpdater(0x547fd28), parent's thread is QThread(0x1bafde10), current thread is QThread(0x1ee19410)

    Despite that code does everything what is suppose to do :)
    Is it safe to leave it like that?
    Or there is some cleaner way to do that.
    Any hints would be priceless.
    Thanks,
    Tomek

    B 1 Reply Last reply
    0
    • K Kaluss

      Hi,
      I got following problem during my code execution:
      When I run function via QtConcurrent::run where I got:

         QProcess unpackProcess( this );
      
         unpackProcess.start( "powershell ", args );
      

      I get debug message:
      QObject: Cannot create children for a parent that is in a different thread.
      (Parent is InvSystem::AppUpdater(0x547fd28), parent's thread is QThread(0x1bafde10), current thread is QThread(0x1ee19410)

      Despite that code does everything what is suppose to do :)
      Is it safe to leave it like that?
      Or there is some cleaner way to do that.
      Any hints would be priceless.
      Thanks,
      Tomek

      B Offline
      B Offline
      Bonnie
      wrote on last edited by Bonnie
      #2

      @Kaluss Since your QProcess is on the stack and doesn't need to be deleted, you can leave the parent to nullptr, just

      QProcess unpackProcess;
      
      1 Reply Last reply
      1
      • K Offline
        K Offline
        Kaluss
        wrote on last edited by
        #3

        Hi,
        thanks a lot. That was exactly what I need!

        Best regards,
        Tomek

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Why do you need QtConcurrent to run a QProcess?

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0
          • K Offline
            K Offline
            Kaluss
            wrote on last edited by
            #5

            Hi,
            I run by qtconcurrent::run function which does a lot of stuff. One of them is unpacking zip file what I do by run powershell command on windows using QProcess to execute that. If know better way I will be grateful for sharing ;)

            Best regards,
            Tomek

            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