第一种: 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