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

【Bug v1.3.3】小概率,拖入图片导致界面卡死 #126

Closed
hiroi-sora opened this issue Apr 19, 2023 · 3 comments
Closed

【Bug v1.3.3】小概率,拖入图片导致界面卡死 #126

hiroi-sora opened this issue Apr 19, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@hiroi-sora
Copy link
Owner

此异常仅在v1.3.3出现。表现为拖入图片或文件夹到主界面,小概率下会导致程序卡死或闪退。

正在修复中。

若您经常遇到类似问题,可换用按钮导入图片,或降级回v1.3.2版本。

@hiroi-sora hiroi-sora added the bug Something isn't working label Apr 19, 2023
@hiroi-sora
Copy link
Owner Author

hiroi-sora commented Apr 19, 2023

暂时推测,此Bug可能由v1.3.3的新功能“命令行模式”引发。utils\command_arg.py 会启动一个线程并监听命名管道,其中的 win32pipe.ConnectNamedPipe(pipe, None) 在拖入图片时有小概率引发一个致命错误:

Fatal Python error: PyEval_RestoreThread: NULL tstate
Python runtime state: initialized

拖入图片时,ui\win_main.py 会通过windnd库,触发 draggedImages() 方法,修改tk界面表示。可能修改tk界面表示时,tk内部的一些通信与上述监听线程干涉,导致错误。

hiroi-sora added a commit that referenced this issue Apr 20, 2023
注:此Bug本质的原因可能跟tk消息循环有关,涉及比较底层的东西,我可能没有能力处理。
作为应急措施,我将拖入图片的事件改为了加入after队列、延迟几十毫秒后再执行。这样也许能够减少拖入事件与tk事件循环产生冲突的几率。经过测试,这个方法可以大幅降低异常发生的概率,几乎达到不可复现。
@hiroi-sora
Copy link
Owner Author

采取了一些措施后,可以缓解这个Bug的产生了。

@hiroi-sora
Copy link
Owner Author

v1.3.4 已发布,理论上已修复该问题。若在 v1.3.4 仍有该问题复现,请在本issue下留言,谢谢。

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

1 participant