Results 1 to 2 of 2

Thread: Strange Behaviour with QProcess, QFileDialog and gdb

  1. #1
    Join Date
    Jan 2006
    Location
    La Spezia,Italy
    Posts
    77
    Thanks
    9
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Strange Behaviour with QProcess, QFileDialog and gdb

    Hello, I was trying to discover the origin of a strange crash in my application and I came up with a strange beaviour of gdb whilst using QProcess and QFileDialog. This is the code to test:

    Qt Code:
    1. #include <QProcess>
    2. #include <QString>
    3. #include <QFileDialog>
    4. #include <QApplication>
    5.  
    6. void fai()
    7. {
    8. QProcess myProcess2;
    9. myProcess2.start("ps -aux");
    10. myProcess2.waitForFinished(-1);
    11.  
    12. //Choose a file or press "Cancel", it's the same
    13. QFileDialog::getOpenFileName(0,"Select File Name","","*");
    14.  
    15. QProcess myProcess;
    16. myProcess.start("ps -aux");
    17. myProcess.waitForFinished(-1);
    18. }
    19.  
    20. int main(int argc, char **argv)
    21. {
    22. QApplication app(argc,argv);
    23.  
    24. fai();
    25. fai();
    26.  
    27. return 0;
    28. }
    To copy to clipboard, switch view to plain text mode 

    The basic behaviour is to run a process, show a filedialog, close the dialog (no matter which choice do you make), and start another process.
    Usually the problem arisies at the beginning of the second iteration but sometimes happes even during the first call to "fai()".
    The program runs fine if I run it w/o a gdb attached to it. But if I try to debug it, gdb fails giving an error about "Couldn't get register" and the program hangs w/o the possibility to resume it. If I put a breakpoint during the execution of the program, the problems doens't show either. Using visual studio this problem doens't show.

    Any hints?

    I apologize for being of topic if this is not a Qt releated problem.

  2. #2
    Join Date
    Apr 2010
    Location
    Rostov-na-Donu, Russia
    Posts
    153
    Thanks
    2
    Thanked 26 Times in 23 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Strange Behaviour with QProcess, QFileDialog and gdb

    To my shame, I don't know what gds is. But I tried to run your code debugging it with MSVC 2008 and I had no messages, no crashes, ets.

Similar Threads

  1. Strange QGridLayout behaviour
    By Mat12345 in forum Qt Programming
    Replies: 0
    Last Post: 7th November 2009, 10:48
  2. Strange mouseReleaseEvent behaviour.
    By ricardo in forum Newbie
    Replies: 11
    Last Post: 5th May 2009, 23:35
  3. Need help: Strange behaviour
    By navi1084 in forum Qt Programming
    Replies: 3
    Last Post: 14th November 2008, 04:03
  4. Strange behaviour of QPainter...
    By oscar in forum Qt Programming
    Replies: 2
    Last Post: 8th November 2008, 12:07
  5. very strange behaviour
    By regix in forum Qt Programming
    Replies: 23
    Last Post: 20th July 2006, 17:38

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
  •  
Qt is a trademark of The Qt Company.