Skip to content

Commit

Permalink
Merge pull request #448 from Hpero4/master
Browse files Browse the repository at this point in the history
1. FIX #379 特定条件下搜索导致软件卡死
  • Loading branch information
Zzaphkiel authored Aug 15, 2024
2 parents c4c9120 + eb5871a commit 22172c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/components/search_line_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,7 @@ def _showCompleterMenu(self):
self._completerMenu.popup()

def focusInEvent(self, e):
self._showCompleterMenu()
super().focusInEvent(e)
# FIX: BUG#379 特定条件下搜索栏候选条会反复得到并失去焦点, 导致UI卡死 -- By Hpero4
if e.reason() != 4:
self._showCompleterMenu()
super().focusInEvent(e)
3 changes: 3 additions & 0 deletions app/view/search_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,8 @@ async def searchAndShowFirstPage(self, puuid=None):

while not self.gameLoadingTask.cancelled() \
and not self.gameLoadingTask.done():
# FIX: task有可能会错过cancel(), 导致必须等到查询结束; -- By Hpero4
self.gameLoadingTask.cancel()
await asyncio.sleep(.2)

self.puuid = summoner['puuid']
Expand All @@ -1130,6 +1132,7 @@ async def searchAndShowFirstPage(self, puuid=None):
# 启动任务,往 gamesTab 里丢数据
# NOTE 既然创建新任务, 并且刷新了self.puuid 就应该用self的, 否则就违背了loadGames判断的初衷

# FIXME: 当从两名召唤师之间反复横跳时, 有可能会导致一puuid起了2个(或更多)task -- By Hpero4
self.gameLoadingTask = asyncio.create_task(
self.__loadGames(self.puuid))

Expand Down

0 comments on commit 22172c7

Please sign in to comment.