标题:求助,使用getSaveFileName 在debug下报异常
作者:11hours
日期:2017-06-13 11:09
内容:
很简单的代码,基于MAINWINDOW程序,运行QFileDialog::getSaveFileName就报异常
#include "mainwindow.h"
#include
#include
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
QString xlsFile = QFileDialog::getSaveFileName(this, QString("111"),
QString("E:/GoogleDrive/Projects/QT/FRACTURE/test.xlsx"),
QString("excel(*.xls *.xlsx)"),
&QString("excel(*.xls *.xlsx)"), QFileDialog::HideNameFilterDetails);
}异常为
error: Exception at 0x7fff8c3295fc, code: 0x8001010e: , flags=0x1 (execution cannot be continued) (first chance)
debug下这段代码放到任何位置都会报这样的异常。只有将Options options = [/back ..
#1 [11hours 06-13 11:51]
查到了一篇关于code: 0x8001010e的解释
The error 0x8001010E is RPC_E_WRONG_THREAD "The application called an interface that was marshalled for a different thread.".
You are breaking COM apartment rules and you are attempting to use an interface pointer on a thread that does not belong to apartment the pointer is valid for. To pass interface pointer to another apartment use marshaling.
就算知道原因可怎么改啊