I tried to make pyqt5 application with QWebEnginePage rebootable. But got segfault. Here is code sample:
import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWidgets import qApp
#from PyQt5.QtWebEngineWidgets import QWebEnginePage
from PyQt5.QtCore import QTimer
from PyQt5.QtWidgets import QMainWindow
from PyQt5.QtWebEngineWidgets import QWebEngineView
class MainWindow(QMainWindow):
EXIT_CODE_REBOOT = -123
def __init__(self,parent=None):
QMainWindow.__init__(self, parent)
self.timer = QTimer()
self.timer.timeout.connect(self.restart)
self.timer.start(3 * 1000)
self.qwe = QWebEngineView()
#self.qp = QWebEnginePage() # uncomment this will cause Segmentation fault (core dumped)
def restart(self):
print('restart')
qApp.exit(MainWindow.EXIT_CODE_REBOOT)
if __name__=="__main__":
currentExitCode = MainWindow.EXIT_CODE_REBOOT
while currentExitCode == MainWindow.EXIT_CODE_REBOOT:
print('next..')
a = QApplication(sys.argv)
w = MainWindow()
w.show()
currentExitCode = a.exec_()
a = None
With this comments - it works fine. But if remove comment's 'Segmentation fault (core dumped)' appears.
Can you give me an advice for this?
EDIT
Reproduced on PyQt 5.9.3 and Ubuntu 14.04