Qt 5.2.1 QFileDialog GDB strange behaviour

96 Views Asked by At

I'm using Qt 5.2.1 MinGW 32bit on a Windows 7 machine with gdb from the MinGW 4.8. There is a strange behaviour when i try to singlestep through the code.

QFileDialog open;
open.setDefaultSuffix("tst");
QString fileName=open.getSaveFileName(this,tr("New File"),"",tr("Test File (*.tst)"));
if(fileName!="")
{
...

Im setting a breakpoint at the 1st Line. Singlestepping works until the 3rd Line, than, after choosing a file, gdb says:

Cannot insert breakpoint -1217. Error accessing memory address 0x7219cd30: Input/output error.

When i set a Breakpoint insede the if or after, the Debugger stops at the Breakpoint, but when i try to singlestep after the stop, the same error occurs.

When i set the FileName directly like:

QFileDialog open;
open.setDefaultSuffix("tst");
QString fileName="D:\path\to\File.tst";
if(fileName!="")
{
...

Singlestepping works without any problems.

The Code above runs without any problem, the problem only occurs when i try to singlestep.

Does anyone knows the problem, or a suitable workaround?

1

There are 1 best solutions below

0
Jens On BEST ANSWER

QFileDialog::getSaveFileName() is a static function, but you call it like a member method. I'm only guessing, but probably the way you are calling a static member via an object confuses your debugging environment - the compiler should generate valid code though, so running over your code will work.

BTW, setDefaultSuffix will not work as expected, as getSaveFileName is a static member and will not look at your QFileDialog object.