PDA

View Full Version : Strange Behaviour with QProcess, QFileDialog and gdb



vratojr
27th May 2010, 10:01
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:



#include <QProcess>
#include <QString>
#include <QFileDialog>
#include <QApplication>

void fai()
{
QProcess myProcess2;
myProcess2.start("ps -aux");
myProcess2.waitForFinished(-1);

//Choose a file or press "Cancel", it's the same
QFileDialog::getOpenFileName(0,"Select File Name","","*");

QProcess myProcess;
myProcess.start("ps -aux");
myProcess.waitForFinished(-1);
}

int main(int argc, char **argv)
{
QApplication app(argc,argv);

fai();
fai();

return 0;
}


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.

borisbn
27th May 2010, 11:48
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.