查看完整版本: [-- 求助,使用getSaveFileName 在debug下报异常 --]

QTCN开发网 -> Qt基础编程 -> 求助,使用getSaveFileName 在debug下报异常 [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

11hours 2017-06-13 11:09

求助,使用getSaveFileName 在debug下报异常

很简单的代码,基于MAINWINDOW程序,运行QFileDialog::getSaveFileName就报异常
  1. #include "mainwindow.h"
    #include <QFileDialog>
    #include <QString>
    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 = Options() 设为DontUseNativeDialog 才不会报。
release下没有报异常。

我的系统为windows 8.1 64位


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




11hours 2017-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.
就算知道原因可怎么改啊


查看完整版本: [-- 求助,使用getSaveFileName 在debug下报异常 --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled