Releasing reference to QWidget on closeEvent
Julio César Gázquez
julio at mebamutual.com
Thu Oct 29 17:33:13 GMT 2020
Hello list.
I have been doing things like in the sample code below for years.
Recently I found that using Ubuntu 20.04 package for PyQt5 results in a
SIGSEGV. It works ok using Phil's wheel package, and also works ok using
the distro package in older versions of Ubuntu.
Today, just before filing a bug report to Ubuntu, I found that adding a
self.deleteLater() call the problem dissappeared.
So, ¿I should use deleteLater() and did the things wrong the last 8
years, o it is really a bug in Ubuntu's package?
from PyQt5.QtWidgets import QWidget, QApplication
window = None
class MyWindow(QWidget):
def closeEvent(self, event):
global window
# SIGSEGV if set window to None
window = None
event.accept()
app = QApplication([])
window = MyWindow()
window.show()
app.exec_()
TIA.
Julio.
More information about the PyQt
mailing list