'PySide2 crash when creating QApplication subclass within main()
I have a PySide2 (5.15.2.1) app on macOS 10.14.6 that works fine under Python 3.6 and 3.7 but crashes under Python 3.8. The minimal crashing example (seg fault 11) is:
from PySide2 import QtCore, QtWidgets
from PySide2.QtCore import Qt
class AppSubclass(QtWidgets.QApplication):
def __init__(self, *args, **kwargs):
QtWidgets.QApplication.__init__(self, *args, **kwargs)
def main():
app = AppSubclass()
if __name__=="__main__":
main()
Strangely, removing the main function results in no crash:
from PySide2 import QtCore, QtWidgets
from PySide2.QtCore import Qt
class AppSubclass(QtWidgets.QApplication):
def __init__(self, *args, **kwargs):
QtWidgets.QApplication.__init__(self, *args, **kwargs)
app = AppSubclass()
Is there something not right about how I'm subclassing QApplication?
Solution 1:[1]
This turns out to likely be a bug in PySide, which has been solved. See https://bugreports.qt.io/browse/PYSIDE-1447
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | jamesbcd |
