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:
Code:
#include <QProcess>
#include <QString>
#include <QFileDialog>
#include <QApplication>
void fai()
{
myProcess2.start("ps -aux");
myProcess2.waitForFinished(-1);
//Choose a file or press "Cancel", it's the same
QFileDialog::getOpenFileName(0,
"Select File Name",
"",
"*");
myProcess.start("ps -aux");
myProcess.waitForFinished(-1);
}
int main(int argc, char **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.
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.