特定网站在 QWebView 中抛出异常

Specific websites throwing an exception in QWebView

虽然 运行 我的代码在尝试使用 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 文件还包括 webkitwidgetsnetwork:

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?

原来这个错误其实是一个Qt的bug。 它的状态可以在这里查看:Qt Bug Report

使用新的 Qt WebEngine Widgets 模块对我来说效果很好。