Scighost / Starward

Game Launcher for miHoYo - 米家游戏启动器
https://starward.scighost.com
MIT License
3.46k stars 165 forks source link

fix: fixed the bug that method `CurrentTaskFinished` was executed multiple times by multiple threads #1084

Closed iamscottxu closed 2 weeks ago

iamscottxu commented 3 weeks ago

修复了 #1082 和 #1083 提及的bug。

另外,照此方法修改后,ConcurrentExecuteThreadCount_concurrentExecuteThreadCount本质上已经没有用处了,如果后续不需要知道当前正在运行的Tasks数量,可将其删除。StartTask会反复执行,还是需要使用ConcurrentExecuteThreadCount判断上一个任务的线程是否已经完全退出)

Scighost commented 3 weeks ago

很可惜,修改后的代码没能通过测试,一键修复过程完成校验后,无法进入到下载流程。

iamscottxu commented 3 weeks ago

抱歉,无法进入下载流程的原因是没有考虑到StartTask会被多次执行,加了一行State == None的判断逻辑导致的,修改后使用_concurrentExecuteThreadCount > 0进行判断,达到同样的效果,解决此问题。