Results 1 to 5 of 5

Thread: QProcess doesn't terminate

  1. #1
    Join Date
    Sep 2007
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QProcess doesn't terminate

    Hello,

    I've got a problem with a QProcess.

    My MainWindow class calls StartProcessClass. StartProcessClass initalizes a QProcess* member. Then, MainWindow tells the class to start the process (with start(appName), NOT startDetached(appName)).

    When I close my MainWindow, I call a slot in StartProcessClass that sends the process a terminate() and closes the MainWindow.

    No threads in this context (another subclas of MainWindow has threads, but in no relation to the process class).


    Even in the process tree I can clearly see that the appName created process is a child of my program. But when the parent closes, the child doesn't. It's driving me nuts. Any idea?

  2. #2
    Join Date
    Sep 2007
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess doesn't terminate

    Apparently this does only happen now when I kill the parent process from the system...

  3. #3
    Join Date
    Sep 2007
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess doesn't terminate

    I discovered something even worse:

    When I send the process a terminate(), it doesn't ask for saving of unsaved changes.

    No one here who can help? :-(

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QProcess doesn't terminate

    From QProcess::terminate() docs:
    Attempts to terminate the process.

    The process may not exit as a result of calling this function (it is given the chance to prompt the user for any unsaved files, etc).

    On Windows, terminate() posts a WM_CLOSE message to all toplevel windows of the process and then to the main thread of the process itself. On Unix and Mac OS X the SIGTERM signal is sent.

    Console applications on Windows that do not run an event loop, or whose event loop does not handle the WM_CLOSE message, can only be terminated by calling kill().
    J-P Nurmi

  5. #5
    Join Date
    Sep 2007
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess doesn't terminate

    Yeah, I know that, maybe I didn't state my problems clear enough.

    1) Terminate just "kills" the QProcess, it doesn't ask for unsaved changes as it should.

    2) If I kill the parent process (via #kill <pid>), the child process continues to run.

Similar Threads

  1. QProcess and Pipes
    By KaptainKarl in forum Qt Programming
    Replies: 1
    Last Post: 9th April 2007, 23:11
  2. QProcess extremely slow on Windows?
    By Pepe in forum Qt Programming
    Replies: 2
    Last Post: 26th March 2007, 00:25
  3. Replies: 4
    Last Post: 27th July 2006, 11:13
  4. problem with qprocess
    By deekayt in forum Qt Programming
    Replies: 2
    Last Post: 13th June 2006, 13:30
  5. QProcess in a QThread
    By chombium in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2006, 15:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.