Skip to content

Commit

Permalink
修复可能访问最近队友飞出组件的悬空指针的问题 (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzaphkiel committed Jun 22, 2024
1 parent d81c61c commit 7261935
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 20 deletions.
40 changes: 23 additions & 17 deletions app/lol/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
import aiohttp
from PyQt5.QtCore import pyqtSignal, QObject

from ..common.config import cfg, Language
from ..common.logger import logger
from ..common.signals import signalBus
from ..common.util import getPortTokenServerByPid
from .exceptions import *
from app.common.config import cfg, Language
from app.common.logger import logger
from app.common.signals import signalBus
from app.common.util import getPortTokenServerByPid
from app.lol.exceptions import *

requests.packages.urllib3.disable_warnings()

Expand Down Expand Up @@ -829,14 +829,26 @@ async def spectate(self, summonerName):

return res

def getConversations(self):
res = self.__get("/lol-chat/v1/conversations").json()
async def dodge(self):
data = {
"destination": 'lcdsServiceProxy',
"method": 'call',
"args": '["", "teambuilder-draft", "quitV2", ""]'
}

return res
res = await self.__post("/lol-login/v1/session/invoke", data=data)

def getHelp(self):
res = self.__get("/help").json()
return res
return await res.json()

async def getConversations(self):
res = await self.__get("/lol-chat/v1/conversations")

return await res.json()

async def getHelp(self):
res = await self.__get("/help")

return await res.json()

@retry()
async def sendFriendRequest(self, name):
Expand All @@ -851,12 +863,6 @@ async def sendFriendRequest(self, name):

print(await res.read())

def dodge(self):
res = self.__post(
'/lol-login/v1/session/invoke?destination=lcdsServiceProxy&method=call&args=["","teambuilder-draft","quitV2",""])').content

return res

@retry()
def sendNotificationMsg(self, title, content):
data = {
Expand Down
13 changes: 10 additions & 3 deletions app/view/career_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ async def updateInterface(self, puuid=None, summoner=None):

self.setLoadingPageEnabled(True)
self.recentTeammatesInfo = None

if self.recentTeammatesFlyout:
self.recentTeammatesFlyout.close()
self.recentTeammatesFlyout = None
Expand Down Expand Up @@ -565,15 +566,21 @@ def isCurrentSummoner(self):

def __onRecentTeammatesButtonClicked(self):
view = TeammatesFlyOut()
if self.info:

if self.recentTeammatesInfo:
view.setLoadingPageEnabled(False)
view.updateSummoners(self.info)
view.updateSummoners(self.recentTeammatesInfo)

self.recentTeammatesFlyout = Flyout.make(
view, self.recentTeamButton, self, FlyoutAnimationType.DROP_DOWN)
self.recentTeammatesFlyout.closed.connect(
self.__resetRecentTeammatesFlyout)

def __resetRecentTeammatesFlyout(self):
self.recentTeammatesFlyout = None

async def __updateRecentTeammates(self):
self.info = await getRecentTeammates(self.games['games'], self.puuid)
self.recentTeammatesInfo = await getRecentTeammates(self.games['games'], self.puuid)

if self.recentTeammatesFlyout:
self.recentTeammatesFlyout.close()
Expand Down

0 comments on commit 7261935

Please sign in to comment.