Releasing reference to QWidget on closeEvent

Julio César Gázquez julio at
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

app = QApplication([])
window = MyWindow()



More information about the PyQt mailing list