[gnome-music/wip/mschraal/asyncqueue-fix-cover-cycling: 5/7] asyncqueue: Favour new queue additions
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/asyncqueue-fix-cover-cycling: 5/7] asyncqueue: Favour new queue additions
- Date: Tue, 29 Mar 2022 11:36:29 +0000 (UTC)
commit 14b6f6bd8c04672c3dc71dc058e3cd37ec387d78
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]