⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

QtConcurrent::run children warning

  • 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.

  • @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;

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

    Best regards,

  • Lifetime Qt Champion

    Why do you need QtConcurrent to run a QProcess?

  • 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,

Log in to reply