Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InfoBar有时出现错误堆栈错误 #273

Open
qianye216 opened this issue Jun 11, 2023 · 10 comments
Open

InfoBar有时出现错误堆栈错误 #273

qianye216 opened this issue Jun 11, 2023 · 10 comments
Labels
bug Something isn't working

Comments

@qianye216
Copy link

直接使用Vscode运行程序,有时看到终端报以下错误,主程序未崩溃闪退
看错误提示应该是infobar的原因:

  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/qfluentwidgets/components/widgets/info_bar.py", line 417, in eventFilter
    return super().eventFilter(obj, e)
RuntimeError: wrapped C/C++ object of type TopInfoBarManager has been deleted
@qianye216 qianye216 added the bug Something isn't working label Jun 11, 2023
@zhiyiYo
Copy link
Owner

zhiyiYo commented Jun 11, 2023

应该是因为 InfoBar 对象被销毁了,而 InfoBarManager 没有及时移除对象导致的。讲道理 InfoBar.closeEvent() 里面会发出一个信号让 InfoBarManager 移除自己,不知道为什么这个信号没有发出去

@Cheukfung
Copy link
Contributor

退出软件的时候偶尔也会触发这个问题,不过不影响正常运行

@Xisenqvq
Copy link

我也有偶尔遇见过,在pyside6上尤为严重,几乎100%复现且偶尔会出现infobar错位,已经开始怀疑是自己的问题了

Repository owner deleted a comment from YiChen1997 Jul 1, 2023
@zhiyiYo
Copy link
Owner

zhiyiYo commented Jul 1, 2023

我也有偶尔遇见过,在pyside6上尤为严重,几乎100%复现且偶尔会出现infobar错位,已经开始怀疑是自己的问题了

我的 pyside6 不会这样,用的 6.4.2

@LxHTT
Copy link

LxHTT commented Aug 17, 2023

image

@rainzee
Copy link
Contributor

rainzee commented Oct 31, 2023

我也有偶尔遇见过,在pyside6上尤为严重,几乎100%复现且偶尔会出现infobar错位,已经开始怀疑是自己的问题了

可以提供一下最小复现代码吗?

@LimeBow-Studios
Copy link

#273 (comment)

image

这个错误提示咋做的,没这思路

@LxHTT
Copy link

LxHTT commented Nov 4, 2023

#273 (comment)

image

这个错误提示咋做的,没这思路

接管sys.excepthook,自己处理。
参考https://github.com/MCSLTeam/MCSL2/blob/10f367beaecb52c903022b72cfb7f28cdbf253d7/MCSL2Lib/windowInterface.py#L352C9-L352C24

@gcc2001
Copy link

gcc2001 commented Feb 18, 2024

image

近期我是用InfoBar也出现了RuntimeError,测试环境如下:

  • python 3.10.11
  • Windows 11 23H2
  • PyQt-Flunet-Widgets==1.5.0
  • Nutika==1.8.4/2.0.0

有两种情况会引发RuntimeError

  • 通过脚本运行并正常退出后,偶发性触发RuntimeError
  • 使用Nuitka打包后,当界面中出现InfoBar控件并手动关闭,几秒后程序意外退出,经过debug发现是触发RuntimeError

而测试使用pyinstaller打包程序后按照情况2进行操作,不会触发RuntimeError

问题主要是出在这一段代码上

def __fadeOut(self):
""" fade out """
self.opacityAni.setDuration(200)
self.opacityAni.setStartValue(1)
self.opacityAni.setEndValue(0)
self.opacityAni.finished.connect(self.close)
self.opacityAni.start()

经过测试将代码改成这样,就不会触发RuntimeError(场景2已通过测试,但由于场景1具有偶发性,无法立即复现)

    def __fadeOut(self):
        """ fade out """
        try:
                self.opacityAni.setDuration(200)
                self.opacityAni.setStartValue(1)
                self.opacityAni.setEndValue(0)
                self.opacityAni.finished.connect(self.close)
                self.opacityAni.start()
       except RuntimeError:
                pass

至于为什么会出现pyinstaller打包的程序不会出现,而nutika打包的程序会出现,目前原因不明,我猜测可能与GC有一定的关系。

如果有理解不对的地方,请大佬指正。

@rainzee
Copy link
Contributor

rainzee commented Feb 18, 2024

主要无法稳定复现,所以也不好修

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants