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

1. FIX #379 特定条件下搜索导致软件卡死 #448

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading