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

QtWebEngineProcess.exe doesn't automatically stops if close QDialog with web content

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 5.15.2
    • WebEngine
    • VS2017, Window 10, Qt 5.15.2
    • Windows

    Description

      I was faced with a problem, that after closing QDialog with web content, the QWebEngineProcess.exe process is not closing, only if close the whole application
      Here is a fast example:

      #include <QApplication>
      #include <QWebEngineView>
      #include <QWebEngineSettings>
      #include <QDialog>
      #include <QMainWindow>
      #include <QLayout>
      #include <QtGui>
      #include <QPushButton>
      
      class Dialog : public QDialog
      {
      public:
          Dialog() : QDialog(nullptr)
          {
              resize(512, 512);
              setAttribute(Qt::WA_DeleteOnClose);
              auto verticalLayout = new QVBoxLayout(this);
              verticalLayout->setSpacing(0);
              verticalLayout->setContentsMargins(0, 0, 0, 0);
      
              m_webView = new QWebEngineView(this);
              verticalLayout->addWidget(m_webView);
          }
      
          void openPage(const QUrl& url)
          {
              m_webView->setUrl(url);
          }
      
      private:
          QWebEngineView* m_webView;
      };
      
      
      class MainWindow : public QMainWindow
      {
      public:
          MainWindow() : QMainWindow(nullptr)
          {
              resize(512, 512);
              QPushButton* btn = new QPushButton("open web dialog", this);
              connect(btn, &QPushButton::clicked, [this] ()
                      {
                          if (m_dialog == nullptr)
                          {
                              m_dialog = new Dialog();
                              m_dialog->openPage(QUrl("https://www.qt.io"));
                              m_dialog->show();
                          }
                      });
          }
      
      private:
          QPointer<Dialog> m_dialog;
      
      };
      
      int main(int argc, char *argv[])
      {
          QCoreApplication::setOrganizationName("QtExamples");
          QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
      
          QApplication app(argc, argv);
      
          MainWindow window;
          window.show();
      
          return app.exec();
      }
      

      Steps:

      1. **Execute attached code
      2. Click open web dialog
      3. We will observe 2 QtWebEngineProcess.exe
      4. Close dialog
      5. We will observe 1 QtWebEngineProcess.exe

      Actual behavior:

      After closing QDialog - QtWebEngineProcess.exe exist in process tree until the application will be closed

      Expected behavior:

      After closing QDialog - QtWebEngineProcess.exe disappears from the process tree

       

      Notes:

      Additionally tested delete m_webView ptr, delete QDialog and etc. Nothing works.

      If I'll try to kill the process - it will create another QtWebEngineProcess and close the first one

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qt_webengine_team Qt WebEngine Team
              holiday Mykhailo Prakhov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes