Fix Kodi crashing due to PKC memory leak

- Fixes #531
This commit is contained in:
croneter 2018-10-13 14:43:44 +02:00
parent 90688b0e8e
commit 770b3704e8

View file

@ -668,7 +668,15 @@ class LibrarySync(Thread):
item_number = len(self.updatelist) item_number = len(self.updatelist)
if item_number == 0: if item_number == 0:
return return
if (utils.settings('FanartTV') == 'true' and
item_class in ('Movies', 'TVShows')):
for item in self.updatelist:
if item['plex_type'] in (v.PLEX_TYPE_MOVIE, v.PLEX_TYPE_SHOW):
self.fanartqueue.put({
'plex_id': item['plex_id'],
'plex_type': item['plex_type'],
'refresh': False
})
# Run through self.updatelist, get XML metadata per item # Run through self.updatelist, get XML metadata per item
# Initiate threads # Initiate threads
LOG.debug("Starting sync threads") LOG.debug("Starting sync threads")
@ -679,8 +687,8 @@ class LibrarySync(Thread):
sync_info.PROCESS_METADATA_COUNT = 0 sync_info.PROCESS_METADATA_COUNT = 0
sync_info.PROCESSING_VIEW_NAME = '' sync_info.PROCESSING_VIEW_NAME = ''
# Populate queue: GetMetadata # Populate queue: GetMetadata
for item in self.updatelist: for _ in range(0, len(self.updatelist)):
download_queue.put(item) download_queue.put(self.updatelist.pop(0))
# Spawn GetMetadata threads for downloading # Spawn GetMetadata threads for downloading
threads = [] threads = []
for _ in range(min(state.SYNC_THREAD_NUMBER, item_number)): for _ in range(min(state.SYNC_THREAD_NUMBER, item_number)):
@ -723,16 +731,6 @@ class LibrarySync(Thread):
except: except:
pass pass
LOG.debug("Sync threads finished") LOG.debug("Sync threads finished")
if (utils.settings('FanartTV') == 'true' and
item_class in ('Movies', 'TVShows')):
for item in self.updatelist:
if item['plex_type'] in (v.PLEX_TYPE_MOVIE, v.PLEX_TYPE_SHOW):
self.fanartqueue.put({
'plex_id': item['plex_id'],
'plex_type': item['plex_type'],
'refresh': False
})
self.updatelist = []
@utils.log_time @utils.log_time
def plex_movies(self): def plex_movies(self):