QFileDialog corrupted! QT bug?
-
I create a app base on QmainWindow class, and a function OpenFile to open some file, when I click menu, the open file dialog appears, but disappeared some seconds, and report error as following: 0x00007FF830C031F0 处(位于 QtGuiApplication3.exe 中)引发的异常: 0xC0000005: 读取位置 0x0000000000000000 时发生访问冲突。 Do you meet this kind of problem ? would you be so kind to tell me the solution or direction , I used five days to look for the solution , but failed! if there is no solution, I maybe give up QT developing. thank you very much.the project contents are listed as following:
1. pro file:
# ---------------------------------------------------- # This file is generated by the Qt Visual Studio Tools. # ------------------------------------------------------ TEMPLATE = app TARGET = QtGuiApplication3 DESTDIR = ../x64/Debug QT += core gui widgets qmltest CONFIG += debug DEFINES += _UNICODE _ENABLE_EXTENDED_ALIGNED_STORAGE WIN64 QT_DLL QT_QMLTEST_LIB QT_WIDGETS_LIB INCLUDEPATH += ./GeneratedFiles \ . \ ./GeneratedFiles/$(ConfigurationName) DEPENDPATH += . MOC_DIR += ./GeneratedFiles/$(ConfigurationName) OBJECTS_DIR += debug UI_DIR += ./GeneratedFiles RCC_DIR += ./GeneratedFiles include(QtGuiApplication3.pri)- h file:
#pragma once #include <QtWidgets/QMainWindow> #include "ui_QtGuiApplication3.h" class QtGuiApplication3 : public QMainWindow { Q_OBJECT public: QtGuiApplication3(QWidget *parent = Q_NULLPTR); private: Ui::QtGuiApplication3Class ui; private slots: void OpenFile(); };3.cpp file:
#include "QtGuiApplication3.h" #include <QFileDialog> QtGuiApplication3::QtGuiApplication3(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(OpenFile())); } void QtGuiApplication3::OpenFile() { QString fileName = QFileDialog::getOpenFileName(this, "Open", "", "Design Files (*.gd)"); if (!fileName.isEmpty()) { } else { } }4. interface:

error window:

-
I create a app base on QmainWindow class, and a function OpenFile to open some file, when I click menu, the open file dialog appears, but disappeared some seconds, and report error as following: 0x00007FF830C031F0 处(位于 QtGuiApplication3.exe 中)引发的异常: 0xC0000005: 读取位置 0x0000000000000000 时发生访问冲突。 Do you meet this kind of problem ? would you be so kind to tell me the solution or direction , I used five days to look for the solution , but failed! if there is no solution, I maybe give up QT developing. thank you very much.the project contents are listed as following:
1. pro file:
# ---------------------------------------------------- # This file is generated by the Qt Visual Studio Tools. # ------------------------------------------------------ TEMPLATE = app TARGET = QtGuiApplication3 DESTDIR = ../x64/Debug QT += core gui widgets qmltest CONFIG += debug DEFINES += _UNICODE _ENABLE_EXTENDED_ALIGNED_STORAGE WIN64 QT_DLL QT_QMLTEST_LIB QT_WIDGETS_LIB INCLUDEPATH += ./GeneratedFiles \ . \ ./GeneratedFiles/$(ConfigurationName) DEPENDPATH += . MOC_DIR += ./GeneratedFiles/$(ConfigurationName) OBJECTS_DIR += debug UI_DIR += ./GeneratedFiles RCC_DIR += ./GeneratedFiles include(QtGuiApplication3.pri)- h file:
#pragma once #include <QtWidgets/QMainWindow> #include "ui_QtGuiApplication3.h" class QtGuiApplication3 : public QMainWindow { Q_OBJECT public: QtGuiApplication3(QWidget *parent = Q_NULLPTR); private: Ui::QtGuiApplication3Class ui; private slots: void OpenFile(); };3.cpp file:
#include "QtGuiApplication3.h" #include <QFileDialog> QtGuiApplication3::QtGuiApplication3(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(OpenFile())); } void QtGuiApplication3::OpenFile() { QString fileName = QFileDialog::getOpenFileName(this, "Open", "", "Design Files (*.gd)"); if (!fileName.isEmpty()) { } else { } }4. interface:

error window:

@NeilWang said in QFileDialog corrupted! QT bug?:
Exception thrown at (in QtGuiApplication3.exe): 0xC0000005: Access violation while reading location 0x0000000000000000
Almost certainly accessing a null, uninitialised, or otherwise invalid pointer.
There is nothing in the code you have posted that is an obvious cause for that. Delete all the intermediate files and do a complete rebuild of the project. Run a debug build of your program in the debugger, reproduce the error, and then copy and paste the text of the stack backtrace. Also post the exact code you compiled referenced by the stack trace.