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. StartDetached and Process ID issues

StartDetached and Process ID issues

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.4k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    motorsep
    wrote on last edited by
    #1

    So I finally managed to run a process and quit launcher automatically when process quits. However, when process was running with start(), launcher was frozen. So I figured if I run process detached, then launcher won't be frozen. Sure enough, that works.

    Here is my code: http://pastebin.com/v8Y6zeEt

    However, the issue is that launcher no longer receives signals from the process. So when process quits, launcher still runs. What am I doing wrong ?

    Thanks!

    EDIT: Perhaps I don't need to run detached process. I just need for launcher not to be frozen when process is running.

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

      Hi,

      Several wrong things here:

      • startDetached is static function -> Don't create a QProcess to use it
      • you are creating memory leaks

      Each time you call executeGameBinary or shutdownLauncherBinary you create a new QProcess without even destroying the old one. But that's not the most important since it's the wrong approach to your problem.

      waitForFinished is what is blocking your UI.

      Please look again at the Fluid Launcher example, the usage of QProcess shown there is exactly what you need.

      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
      • M Offline
        M Offline
        motorsep
        wrote on last edited by
        #3

        [quote author="SGaist" date="1405410957"]Hi,
        Each time you call executeGameBinary or shutdownLauncherBinary you create a new QProcess without even destroying the old one. But that's not the most important since it's the wrong approach to your problem.[/quote]

        What would be the correct approach?

        executeGameBinary or shutdownLauncherBinary are called only once - starting the game and quitting launcher. They can't be called more than once (or at least they shouldn't by design, since the game can be launched only once).

        Perhaps I should disable Start and Quit buttons when the process is running, and minimize launcher (or hide it). Are there any examples how to do that?

        [quote author="SGaist" date="1405410957"]waitForFinished is what is blocking your UI.[/quote]

        I see. Basically it's looping, waiting for process to shut down?

        [quote author="SGaist" date="1405410957"]Please look again at the Fluid Launcher example, the usage of QProcess shown there is exactly what you need.[/quote]

        Looked. Seems like I need to figure out slots and signals and connect().

        Thanks.

        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