-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.7.0
-
None
-
Windows 7, Windows 10, PyQt5 based on Qt5.7
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)