简体   繁体   English

在 main() 中创建 QApplication 子类时 PySide2 崩溃

[英]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.我在 macOS 10.14.6 上有一个 PySide2 (5.15.2.1) 应用程序,它在 Python 3.6 和 3.7 下运行良好,但在 Python 3.8 下崩溃。 The minimal crashing example (seg fault 11) is:最小的崩溃示例(段故障 11)是:

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:奇怪的是,删除主 function 不会导致崩溃:

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?我如何继承 QApplication 有什么不对吗?

This turns out to likely be a bug in PySide, which has been solved.事实证明,这很可能是 PySide 中的一个错误,已解决。 See https://bugreports.qt.io/browse/PYSIDE-1447请参阅https://bugreports.qt.io/browse/PYSIDE-1447

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM