Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-87460

qwebenginewidgets module result in crash when restart the application

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.0, 5.15.1, 6.2.2
    • WebEngine
    • None
    • All

    Description

      I found that the qt webengine result in crash issue when I restart my application.

       

      the main code is:

       

      //mainwindow.cpp
      #include "mainwindow.h"
      #include "ui_mainwindow.h"
      #include <QWebEngineView>
      #include <QPushButton>
      #include <QUrl>
      #include <QCoreApplication>
      
      
      MainWindow::MainWindow(QWidget *parent)
          : QMainWindow(parent)
          , ui(new Ui::MainWindow)
      {
          ui->setupUi(this);
          ui->pushButton->setFixedSize(QSize(100,30));
          QWebEngineView* view = new QWebEngineView(this);
          ui->horizontalLayout->insertWidget(1,view);
          view->setUrl(QUrl("https://www.bing.com"));
      
          connect(ui->pushButton,&QPushButton::clicked,[]{
              QCoreApplication::exit(12345);
          });
      }
      
      MainWindow::~MainWindow()
      {
          delete ui;
      }
      
      //main.cpp
      #include "mainwindow.h"
      
      #include <QApplication>
      #include <QWebEngineView>
      #include <QWebEngineProfile>
      #include <QWebEngineSettings>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
          int ret = 0;
          do{
              QApplication a(argc, argv);    
              MainWindow w;
              w.show();
              ret = a.exec();
          } while(ret == 12345);
          return ret;
      
      }
      
      //mainwindow.ui
      <?xml version="1.0" encoding="UTF-8"?>
      <ui version="4.0">
       <class&gt;MainWindow</class&gt;
       <widget class="QMainWindow" name="MainWindow">
        <property name="geometry">
         <rect>
          <x>0</x>
          <y>0</y>
          <width>800</width>
          <height>600</height>
         </rect>
        </property>
        <property name="windowTitle">
         <string>MainWindow</string>
        </property>
        <widget class="QWidget" name="centralwidget">
         <layout class="QHBoxLayout" name="horizontalLayout">
          <item>
           <widget class="QPushButton" name="pushButton">
            <property name="text">
             <string>PushButton</string>
            </property>
           </widget>
          </item>
         </layout>
        </widget>
        <widget class="QMenuBar" name="menubar">
         <property name="geometry">
          <rect>
           <x>0</x>
           <y>0</y>
           <width>800</width>
           <height>23</height>
          </rect>
         </property>
        </widget>
        <widget class="QStatusBar" name="statusbar"/>
       </widget>
       <resources/>
       <connections/>
      </ui>
      
      
      

       

       

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-87460
          # Subject Branch Project Status CR V

          Activity

            People

              qt_webengine_team Qt WebEngine Team
              payne.nie wu ming
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change