- 作者:
- 分类:知识&开发->语言->Python
- 阅读:464
- 点赞:1
- 版权:CC BY-SA 4.0
- 创建:2022-03-02
- 更新:2022-03-04
版权声明:本文为 neucrack 的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接(持续更新):https://neucrack.com/p/411
原文链接(持续更新):https://neucrack.com/p/411
运行退出时偶尔报错,不是 100% 复现
[1] 759959 segmentation fault (core dumped) python
或者
QObject::startTimer: Timers can only be used with threads started with QThread
原因可能有很多,这里遇到的问题原因是使用了
app.installEventFilter(eventFilter)
退出前没有 remove
,需要调用 app.removeEventFilter(eventFilter)
即可
尽管 https://doc.qt.io/qt-5/qobject.html#removeEventFilter 这里说了当对象摧毁时会自动将其移除,可能是对app
这个对象特殊?
void QObject::removeEventFilter(QObject *obj)
Removes an event filter object obj from this object. The request is ignored if such an event filter has not been installed.
All event filters for this object are automatically removed when this object is destroyed.
It is always safe to remove an event filter, even during event filter activation (i.e. from the eventFilter() function).