mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 03:34:15 +02:00
fix: app crashes after installation
This commit is contained in:
@@ -13,8 +13,7 @@ class Cache:
|
|||||||
return self.expiration_time < 0 or self.expiration_time > 0
|
return self.expiration_time < 0 or self.expiration_time > 0
|
||||||
|
|
||||||
def add(self, key: str, val: object):
|
def add(self, key: str, val: object):
|
||||||
|
if key and self.is_enabled():
|
||||||
if self.is_enabled():
|
|
||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
self._add(key, val)
|
self._add(key, val)
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
@@ -24,7 +23,7 @@ class Cache:
|
|||||||
|
|
||||||
def add_non_existing(self, key: str, val: object):
|
def add_non_existing(self, key: str, val: object):
|
||||||
|
|
||||||
if self. is_enabled():
|
if key and self. is_enabled():
|
||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
cur_val = self.get(key)
|
cur_val = self.get(key)
|
||||||
|
|
||||||
@@ -34,7 +33,7 @@ class Cache:
|
|||||||
self.lock.release()
|
self.lock.release()
|
||||||
|
|
||||||
def get(self, key: str):
|
def get(self, key: str):
|
||||||
if self.is_enabled():
|
if key and self.is_enabled():
|
||||||
val = self._cache.get(key)
|
val = self._cache.get(key)
|
||||||
|
|
||||||
if val:
|
if val:
|
||||||
@@ -49,7 +48,7 @@ class Cache:
|
|||||||
return val['val']
|
return val['val']
|
||||||
|
|
||||||
def delete(self, key):
|
def delete(self, key):
|
||||||
if self.is_enabled():
|
if key and self.is_enabled():
|
||||||
if key in self._cache:
|
if key in self._cache:
|
||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
del self._cache[key]
|
del self._cache[key]
|
||||||
|
|||||||
@@ -221,8 +221,9 @@ class InstallApp(QThread):
|
|||||||
self.app.model.installed = True
|
self.app.model.installed = True
|
||||||
|
|
||||||
if self.app.model.supports_disk_cache():
|
if self.app.model.supports_disk_cache():
|
||||||
|
icon_data = self.icon_cache.get(self.app.model.base_data.icon_url)
|
||||||
self.manager.cache_to_disk(app=self.app.model,
|
self.manager.cache_to_disk(app=self.app.model,
|
||||||
icon_bytes=self.icon_cache.get(self.app.model.base_data.icon_url)['bytes'],
|
icon_bytes=icon_data.get('bytes') if icon_data else None,
|
||||||
only_icon=False)
|
only_icon=False)
|
||||||
|
|
||||||
self.app = None
|
self.app = None
|
||||||
|
|||||||
Reference in New Issue
Block a user