[gnome-music/wip/mschraal/rework-art-widget: 6/26] asyncqueue: Favour new queue additions
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/rework-art-widget: 6/26] asyncqueue: Favour new queue additions
- Date: Thu, 7 Apr 2022 22:46:08 +0000 (UTC)
commit 09a0eff6f3a4e6a813b3f60862338f7c7897a7c6
Author: Marinus Schraal <mschraal gnome org>
Date: Thu Mar 17 17:43:08 2022 +0100
asyncqueue: Favour new queue additions
If an object got queued again, the old queue was retained. However, in
the case of ArtCache, this results in the new ArtCache queue being
discarded and the previous art being displayed. This lead to the wrong
art being displayed while cycling widgets in the listmodel views.
When requeing the same object, replace the old instance in the queue.
Fixes: #500
gnomemusic/asyncqueue.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/asyncqueue.py b/gnomemusic/asyncqueue.py
index 2b13c041d..963842e00 100644
--- a/gnomemusic/asyncqueue.py
+++ b/gnomemusic/asyncqueue.py
@@ -72,9 +72,15 @@ class AsyncQueue(GObject.GObject):
"""
async_obj_id = id(args[0])
- if (async_obj_id not in self._async_pool
- and async_obj_id not in self._async_active_pool):
- self._async_pool[async_obj_id] = (args)
+ if async_obj_id in self._async_active_pool:
+ obj = args[0]
+ handler_id, _ = self._async_data.pop(obj)
+ obj.disconnect(handler_id)
+ self._async_active_pool.pop(id(obj))
+ elif async_obj_id in self._async_pool:
+ self._async_pool.pop(async_obj_id)
+
+ self._async_pool[async_obj_id] = (args)
if self._timeout_id == 0:
self._timeout_id = GLib.timeout_add(100, self._dispatch)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]