QFileDialog :: getOpenFileName在调试时崩溃,显然是由项目名称引起的? [英] QFileDialog::getOpenFileName crashes when debugging, apparently caused by project name?

查看:6235
本文介绍了QFileDialog :: getOpenFileName在调试时崩溃,显然是由项目名称引起的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个让我困惑的问题。我使用Qt Creator 3.1.2,在Windows 7上使用Qt 5.3,使用MSVC 10.0编译器和CDB从调试工具为Windows 8.1。 (不知道如果我应该寻找一个Windows 7特定的调试器,但我迄今没有任何问题,直到现在)。



问题:当我尝试在调试时使用QFileDialog :: getOpenFileName(),程序引发异常。


在线程0中停止:0x745f7736处的异常,代码:0xc0000005:读取访问违例:0x0,flags = 0x0(第一次机会)。


发布/调试版本无所谓。如果我运行调试器,它崩溃。如果我不是,它的工作。我尝试了一堆不同的东西,试图找出为什么这是发生 - 我将getOpenFileName移动到程序的不同部分,我尝试更改/删除函数调用的参数,我剥离了基本上所有我的代码,除了显示此文件对话框所需的最低要求 - QApplication和当单击菜单项时调用getOpenFileName()的主窗口。没有什么工作。



然后我创建了一个基本上是一样的新项目。不可避免地,这是工作。所以很多乱七八糟的事,从我的主项目复制东西,直到它开始崩溃,我最终找到了问题:显然,它是由TARGET在.pro文件中设置的可执行文件名。如果它设置为PrimeWorldEditor(我的应用程序的名称),它崩溃。如果我改变它的任何东西,它的工作原理。



所以我的第一个想法是有剩余的文件,与可执行文件共享他们的名称,导致问题。但是,清除构建文件夹,重建项目以及其他任何事情都无济于事。



我已经用完了什么可能是导致问题,我试图,没有找到通过搜索任何其他文件,它们与可执行文件共享其名称或指向它。如果任何人有任何想法的问题可能是,我真的很感谢帮助。我现在可以通过更改可执行文件的名称来解决它,但我真的很想知道为什么会发生并修复它。



编辑:几个人是要求代码,所以这里是一个程序崩溃的例子。再次,这只在运行调试器时崩溃,目标可执行文件名称设置为PrimeWorldEditor。在其他情况下,它按预期工作,并打开getOpenFileName()对话框。

  #include< QApplication> 
#include< QFileDialog>

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

我认为这个问题可能与我的设置有关,不确定它会很容易重现。



编辑2:我想补充说,我花了一段时间Googling尝试找到任何与该问题相关的信息。我发现有几个人似乎和我有相同的问题,喜欢这篇文章,但这些帖子没有任何解决方案。

解决方案

我有同样的问题,解决方案是卸载git软件,这使得上下文菜单在windows explorer。



使用 QFileDialog :: getOpenFileName()



时,程序在Visual Studio 2013 Debugger中崩溃


在读取位置0xFEEEFEEE时访问冲突


当我运行没有调试器的程序或当我设置了组合上下文选项项目配置 - >调试器 - >
与environment =否组合。



我重新安装了Visual Studio,Qt,没有任何帮助。



最后,我删除了我安装的git软件当天,我卸载软件;然后程序在Debugger中不会崩溃。



我使用的是Windows 64位计算机,但使用32位运行Qt程序。 Git软件在Windows资源管理器中有一个上下文菜单,不知何故这干扰了 QFileDialog 并导致了问题。


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.

解决方案

I had the same problem and the solution was to uninstall git software, which made context menu in windows explorer.

I got the problem that the program crashed in Visual Studio 2013 Debugger when using QFileDialog::getOpenFileName():

Access Violation while reading position 0xFEEEFEEE

It did not crash when I run the program without debugger or when I set the combine Context option in the project configuration -> debugger -> combine with environment = "No".

I re-installed Visual Studio, Qt and nothing helped.

Finally I removed the git-software I have installed the same day and I uninstalled the software; then afterwards the program didn't crash in Debugger anymore.

I am using a Windows 64-bit computer, but run the Qt program with 32 bit. The git software had a context menu in the windows explorer and somehow this interfered with QFileDialog and caused the problem.

这篇关于QFileDialog :: getOpenFileName在调试时崩溃,显然是由项目名称引起的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆