• 3116阅读
  • 1回复

[提问]求助,使用getSaveFileName 在debug下报异常 [复制链接]

上一主题 下一主题
离线11hours
 

只看楼主 倒序阅读 楼主  发表于: 2017-06-13
很简单的代码,基于MAINWINDOW程序,运行QFileDialog::getSaveFileName就报异常
  1. #include "mainwindow.h"
  2. #include <QFileDialog>
  3. #include <QString>
  4. MainWindow::MainWindow(QWidget *parent)
  5.     : QMainWindow(parent)
  6. {
  7.     QString xlsFile = QFileDialog::getSaveFileName(this, QString("111"),
  8.     QString("E:/GoogleDrive/Projects/QT/FRACTURE/test.xlsx"),
  9.     QString("excel(*.xls *.xlsx)"),
  10.     &QString("excel(*.xls *.xlsx)"), QFileDialog::HideNameFilterDetails);
  11. }
异常为
error: Exception at 0x7fff8c3295fc, code: 0x8001010e: , flags=0x1 (execution cannot be continued) (first chance)
debug下这段代码放到任何位置都会报这样的异常。只有将Options options = Options() 设为DontUseNativeDialog 才不会报。
release下没有报异常。

我的系统为windows 8.1 64位


百度没有相关问题,google虽然有但情形不一样,怎么办啊。



离线11hours

只看该作者 1楼 发表于: 2017-06-13
查到了一篇关于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.
就算知道原因可怎么改啊
快速回复
限100 字节
 
上一个 下一个