I've run into a problem that's really confusing me. I'm using Qt Creator 3.1.2, with Qt 5.3 on Windows 7, using the MSVC 10.0 compiler and CDB from Debugging Tools for Windows 8.1. (Not sure if I should be looking for a Windows 7-specific debugger, but I haven't had any issues until now).
The problem: when I try to use QFileDialog::getOpenFileName() while debugging, the program throws an exception.
The inferior stopped because it triggered an exception.
Stopped in thread 0 by: Exception at 0x745f7736, code: 0xc0000005: read access violation at: 0x0, flags=0x0 (first chance).
Release/debug build doesn't matter. If I'm running the debugger, it crashes. If I'm not, it works. I tried a bunch of different things to try to figure out why this was happening - I moved the getOpenFileName to a different part of the program, I tried changing/removing the parameters on the function call, I stripped down basically all my code except the bare minimum required to display this file dialog - a QApplication and a main window that called getOpenFileName() when a menubar item is clicked. Nothing worked.
Then I created a new project that was basically the same thing. Inexplicably, -that- worked. So a whole lot of messing around later, and copying things from my main project until it started crashing again, I ended up finding the problem: apparently, it's the executable name set by "TARGET" in the .pro file. If it's set to PrimeWorldEditor (my application's name), it crashes. If I change it to anything else, it works.
So my first thought was that there were leftover files that share their name with the executable somewhere causing problems. However, clearing out the build folder, rebuilding the project, and anything else doesn't help.
I'm at the point where I've run out of ideas for what could be causing the problem, and I've tried and failed to find via search any other files that either share their name with the executable or point to it. If anyone has any idea what the issue could be, I'd really appreciate the help. I could work around it for now by changing the executable's name, but I'd really like to find out why this is happening and fix it.
EDIT: A few people are asking for code, so here's an example of a program that crashes. Once again, this only crashes when running the debugger with the target executable name set to PrimeWorldEditor. Under other circumstances, it works as expected and opens the getOpenFileName() dialog.
#include <QApplication>
#include <QFileDialog>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QFileDialog::getOpenFileName();
return 0;
}
I think the issue is likely something related to my setup, so I'm not sure it'll be easily reproducible.
EDIT 2: I wanna add that I did spend a while Googling to try to find any information related to the issue. I did find a couple people who seemed to have the same problem as me, like this post, but there weren't any solutions on those posts.
getOPenFileName()
is called. – FavorsQFileDialog::getOpenFileName
without the event loop (return a.exec();
) ??? – Coed