From 88ccec0b15212e206be6c24da4da0a2c534af88a Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Tue, 25 Oct 2022 20:06:59 +0200 Subject: [PATCH] Test chiusura globalsearch --- specials/globalsearch.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/specials/globalsearch.py b/specials/globalsearch.py index 85d1cbb9..d02fd5d1 100644 --- a/specials/globalsearch.py +++ b/specials/globalsearch.py @@ -23,6 +23,7 @@ close_action = False update_lock = threading.Lock() moduleDict = {} searchActions = [] +thread = None def busy(state): @@ -78,6 +79,7 @@ EPISODESLIST = 200 SERVERLIST = 300 class SearchWindow(xbmcgui.WindowXML): + global thread def start(self, item, thActions=None): logger.debug() self.exit = False @@ -539,8 +541,8 @@ class SearchWindow(xbmcgui.WindowXML): if self.item.type: self.item.mode = self.item.type self.item.text = scrapertools.title_unify(self.item.text) - self.thread = Thread(target=self.search) - self.thread.start() + thread = Thread(target=self.search) + thread.start() elif self.item.mode in ['movie', 'tvshow', 'person_']: self.select() elif self.item.mode in ['person']: @@ -740,15 +742,11 @@ class SearchWindow(xbmcgui.WindowXML): def Close(self): self.exit = True - if self.thread and self.thread.is_alive(): + if thread and thread.is_alive(): busy(True) for th in self.search_threads: th.cancel() - try: - self.thread.join() - except: - import traceback - logger.error(traceback.format_exc()) + thread.join() busy(False) self.close()