在运行我的代码时,当它尝试使用 QWebView 时出现写入访问冲突异常:
重现错误的最小可编译代码
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QtWebKitWidgets/QWebView>
#include <QUrl>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QWebView *wv = new QWebView(this);
wv->load(QUrl("http://steamcommunity.com/"));
setCentralWidget(wv);
}
MainWindow::~MainWindow()
{
delete ui;
}
pro文件还包括webkitwidgets
和network
:
QT += core gui webkitwidgets network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = MyApp
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
错误提示
我得到的错误是这样的:
ASSERTION FAILED: leftSide->category() != CalcOther && rightSide->category() != CalcOther
css\CSSCalculationValue.cpp(290) : WebCore::CSSCalcBinaryOperation::create
1 0354A5B7
2 02E58E41
3 02E59520
...
我无法提供堆栈跟踪,因为错误在其中一个 Qt 文件中,但这里是反汇编:
该错误仅出现在特定网页(例如 steamcommunity.com)上,而不会出现在其他网页上。是否有可能某些站点只是破坏了 Qt 的 API?
- 编译器:MSVC2013 x86
- Qt版本:Qt 5.5.0
最佳答案
原来这个错误其实是一个Qt bug。 可在此处查看其状态:Qt Bug Report
使用新的 Qt WebEngine Widgets模块作为我的替代品效果很好。
关于c++ - 特定网站在 QWebView 中抛出异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35019036/