QFileDialog :: getOpenFileName crashes during debugging, which is apparently caused by the project name?

I ran into a problem that really baffled me. I am 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 look for a Windows 7-dependent debugger, but so far I have not had any problems).

Problem: when I try to use QFileDialog :: getOpenFileName () during debugging, the program throws an exception.

The demotion is terminated because it caused an exception.

Stopped in thread 0: Exception in 0x745f7736, code: 0xc0000005: read access violation: 0x0, flags = 0x0 (first chance).

Building releases / debugging doesn't matter. If I run the debugger, it will work. If not, it will work. I tried a bunch of different things to try to figure out why this is happening. I moved getOpenFileName to another part of the program, I tried to change / delete the function call parameters, I deleted basically all of my code except the minimum minimum required to display this file dialog box - QApplication and the main window that calls getOpenFileName () when it is clicked menu item. Nothing succeeded.

Then I created a new project, which was basically the same. Inexplicably, something worked. Thus, much later, and copying things from my main project until it crashed again, I discovered a problem: apparently this is the executable name given by “TARGET” in the .pro file. If it is installed on PrimeWorldEditor (my application name), it will work. If I change it to anything else, it will work.

So my first thought was that there were remaining files that shared their name with the executable, which caused problems. However, cleaning the build folder, restoring the project, and something else does not help.

I am at the point where I am running out of ideas about what might cause the problem, and I tried and could not find through the search any other files that either share their name with the executable, or point to It. If anyone knows what the problem is, I would really appreciate help. I could get around this now by changing the name of the executable, but I would really like to know why this is happening and fix it.

EDIT: A few people request the code, so here is an example of a failed program. Once again, this only happens when the debugger starts with the target executable name set in PrimeWorldEditor. In other cases, it works as expected and opens the getOpenFileName () dialog box.

#include <QApplication> #include <QFileDialog> int main(int argc, char *argv[]) { QApplication a(argc, argv); QFileDialog::getOpenFileName(); return 0; } 

I think the problem is probably related to my setup, so I'm not sure if it will be easy to reproduce.

EDIT 2: I want to add that I spent some time on Google to try and find any information related to the problem. I found a couple of people who seemed to have the same problem as myself, like this post , but there were no solutions on these posts.

+3
c ++ debugging qt getopenfilename
source share
2 answers

I had the same problem and the solution was to uninstall the git software that created the context menu in Windows Explorer.

I had a problem with the program working in Visual Studio 2013 Debugger when using QFileDialog::getOpenFileName() :

Access violation while reading position 0xFEEEFEEE

This is not a failure when starting the program without a debugger or when I set the Combine context in the project configuration → debugger → merge with the environment = “No”.

I installed Visual Studio, Qt again, and nothing helped.

Finally, I deleted the git message that I installed on the same day and I uninstalled the software; then after that the program no longer crashed into Debugger.

I am using a 64-bit Windows computer, but I am running Qt with 32-bit. In git software, there was a context menu in Windows Explorer, and this somehow interfered with QFileDialog and caused a problem.

+2
source share

Uhhh, that's okay. For some reason, I noticed DropboxExt_24 in the call stack. So I uninstalled the Dropbox app and suddenly everything is working correctly. Reinstalled it and it still works, so the problem is solved, I think?

I post my code on Dropbox so that it supports it, not sure if this is due to a problem or not.

+1
source share

All Articles