关于QWebEngineView崩溃的几种情况

29 篇文章 3 订阅

第一种:   https://blog.csdn.net/e5Max/article/details/79769076

项目发布后,在某些机器上出现崩溃的现象,经查,是在启动初始化QtWebengine模块时导致的崩溃。然后测试了Qt的官方例子simpleBrownser,在这些机器上同样也出现崩溃,开始以为是缺少资源文件或者是系统需要补丁。久查未果,后来还是在Qt的Bug列表中找到了答案,不得不说, Qt的Bug列表真是个好东西。

1、So far all crash reports in QTBUG-49954 are for aticfx32.dll/aticfx64.dll, 8.17.10.1077 - 8.17.10.1129 . 
It would be valuable information to know which version you're using now, so that we can tell people to upgrade / blacklist the right driver versions.
2、My crash was the same as https://bugreports.qt.io/browse/QTBUG-51157. My computer is not up to date, but I am sure no antivirus in it. 
Furthermore I don't think this crash due to antivirus or system up to date. Because same system iso install my other computer was fine. 
I guess crash due to graphics card or Graphics driver compatible problem. 
I update the crash screenshot to above question, sorry i don't know how to insert image to comment and the screenshot it's Chinese.
3、As the crash you linked was due to out-of-date GL drivers, could you please try and upgrade those? 
Also, does the computer that it works on have the same graphics hardware ass the one that it crashes with? 
They might have been installed from the same iso, but if the hardware is different, then different drivers will be used of course.

原因是:机器的显卡和系统所带的显卡驱动不匹配,导致QtWebEngine在渲染时出现了崩溃。

解决办法:升级显卡驱动(如果是集成显卡,可能需要升级主板驱动)。


相关链接:
https://bugreports.qt.io/browse/QTBUG-51157
https://bugreports.qt.io/browse/QTBUG-53692

https://bugreports.qt.io/browse/QTBUG-54031



第二种:   https://blog.csdn.net/jiaoyaziyang/article/details/78203619

第一次用这个模块,安装到没有环境的电脑上load总是崩溃 ,各种百度 发现一个英文问答,我觉得还是看英文问答比较有用

解决方法如下;

  在软件运行目录下添加文件,目前还不知道这几个文件起到什么作用,随后再看

目录是:.\Qt5.9\5.9.1\msvc2015_64\resources\

icudtl.dat

qtwebengine_devtools_resources.pak

qtwebengine_resources.pak

qtwebengine_resources_100p.pak

qtwebengine_resources_200p.pak


目录是:.\Qt5.9\5.9.1\msvc2015_64\bin\

QtWebEngineProcess.exe

QtWebEngineProcessd.exe


第三种:    https://blog.csdn.net/cammyn/article/details/52849254

qwebengineview:当新建一个qwidget来放显示页面时,程序退出时一定要释放资源

我使用qt5.5的时候当连续点击界面会导致程序崩掉,5.7不会

webui.h

#ifndef WEBUI_H
#define WEBUI_H

#include <QWidget>
#include <QWebEngineView>
class WebUi : public QWidget
{
    Q_OBJECT

public:
    explicit WebUi(QObject *parent = 0);
    ~WebUi();
    void resizeEvent(QResizeEvent*);

private:
    QWebEngineView* view;
};

#endif // WEBUI_H
12345678910111213141516171819

webui.cpp

#include "webui.h"

WebUi::WebUi(QObject *parent) 
 : view(NULL)
{
    QVBoxLayout* vbox = new QVBoxLayout(this);
    view = new QWebEngineView(this);
    if (view != NULL)
    {
        view->setUrl(QUrl(ASD_ADDRESS));
        view->show();
    }
    vbox->addWidget(view);
    this->setLayout(vbox);
}

WebUi::~WebUi()
{
    view->deleteLater();
}

void WebUi::resizeEvent(QResizeEvent*)
{
    if (view != NULL)
    {
        view->resize(this->size());
    }
}
12345678910111213141516171819202122232425262728

mainwindow.h

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "webui.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H
1234567891011121314151617181920212223

mainwindow.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QVBoxLayout>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    view(NULL)
{
    QVBoxLayout* vbox = new QVBoxLayout(this);
    WebUi* m_webUi = new WebUi();
    vbox->addWidget(m_webUi);
    this->setLayout(vbox );
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    m_webUi->deleteLater();//退出程序的时候一定要调用它来释放资源,否则程序会崩溃
    delete ui;
}
123456789101112131415161718192021

main.cpp

#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
}
1234567891011


如果在使用 VS2015 进行 Qt 开发时,调用 QWebEngineView 的 load() 函数导致程序崩溃,可能是由于缺少必要的依赖文件或配置不正确导致的。以下是一些可能的解决方案: 1. 确保已正确配置 Qt WebEngine 模块:在 .pro 文件中添加 `QT += webenginewidgets`,并重新生成项目。 2. 检查 Qt 安装是否包含 Qt WebEngine 组件:打开 Qt 维护工具,并确保已安装了 Qt WebEngine 组件。如果没有,请选择安装该组件。 3. 检查运行环境是否缺少必要的依赖项:Qt WebEngine 需要一些系统依赖项,如 Chromium 内核和相关库。请确保你的系统上已正确安装这些依赖项。如果运行环境缺少必要的依赖项,可以尝试重新安装 Qt 或使用 Qt 的预编译版本。 4. 确保使用的 Qt 版本与 VS2015 兼容:在使用 VS2015 进行 Qt 开发时,需要确保选择了与 VS2015 兼容的 Qt 版本。不同版本的 VS 和 Qt 可能存在兼容性问题,导致程序崩溃。 5. 检查是否有其他冲突的插件或第三方库:有时,与 QWebEngineView 相关的其他插件或第三方库可能与程序崩溃有关。尝试禁用或卸载其他插件或第三方库,然后重新运行程序,看看是否仍然导致崩溃。 如果上述解决方案仍然无法解决问题,你可以尝试在调试模式下运行程序,以便获得更详细的错误信息和堆栈跟踪,以便更好地定位问题所在。同时,你还可以在 Qt 官方论坛或社区中提问,以获取更多专业的帮助和支持。 希望这些解决方案对你有所帮助!如果你还有其他疑问,请随时提问。
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值