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

QWebEngineView cannot be deleted or closed normally

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.7.0
    • WebEngine
    • None
    • Windows 7, Windows 10, PyQt5 based on Qt5.7

    Description

      I found that QWebEngineView behaves very strange (Windows PyQt 5.7) and in some cases does not finish properly leaving the application hanging. If lines marked #1 and #2 are uncommented, then the application keeps hanging after closing, the process still running. The same happens if you uncomment only #3 (and comment out #1 and #2). I tried this with other widgets than QWebEngineView, and no problems occurred.

      import sys
      from PyQt5 import QtCore, QtWidgets, QtWebEngineWidgets
      app = QtWidgets.QApplication(sys.argv)
      mainWindow = QtWidgets.QMainWindow()
      widget = QtWebEngineWidgets.QWebEngineView()
      widget.load(QtCore.QUrl("http:/www.google.com"))  #1
      mainWindow.setCentralWidget(widget)
      mainWindow.setCentralWidget(None)                 #2
      # widget.deleteLater()                              #3
      mainWindow.show()
      sys.exit(app.exec_())
      

      Later I found even simpler example exhibiting the described issue. Running this on Windows, PyQt 5.7 leaves the application hanging.

      import sys
      from PyQt5 import QtCore, QtWidgets, QtWebEngineWidgets
      app = QtWidgets.QApplication(sys.argv)
      widget = QtWebEngineWidgets.QWebEngineView()
      widget.setAttribute(QtCore.Qt.WA_DeleteOnClose)
      widget.show()
      result = app.exec_()
      del widget
      del app  # having this here makes the application close correctly
      # without the previous line, the application hangs
      sys.exit(result)
      

      Attachments

        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
            vladimir.kraus Vladimir Kraus
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes