[gnome-music/wip/mschraal/asyncqueuefixes: 2/2] asyncqueue: Argument passing fixes




commit 940a59a65cce42bcae733ab0c66538943d7cdf47
Author: Marinus Schraal <mschraal gnome org>
Date:   Fri Aug 27 15:48:57 2021 +0200

    asyncqueue: Argument passing fixes
    
    There were a few not currently harmful mistakes in the argument parsing.
    Also rename some of the variables for clarity.

 gnomemusic/asyncqueue.py | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/gnomemusic/asyncqueue.py b/gnomemusic/asyncqueue.py
index 53357274a..35c756319 100644
--- a/gnomemusic/asyncqueue.py
+++ b/gnomemusic/asyncqueue.py
@@ -70,10 +70,9 @@ class AsyncQueue(GObject.GObject):
         else:
             return
 
-        def on_async_finished(*args):
-            async_obj = args[0]
-            async_obj.disconnect(result_id)
-            self._async_active_pool.pop(id(async_obj))
+        def on_async_finished(obj, *signal_args):
+            obj.disconnect(result_id)
+            self._async_active_pool.pop(id(obj))
 
             if len(self._async_pool) > 0:
                 key = list(self._async_pool.keys())[0]
@@ -81,9 +80,9 @@ class AsyncQueue(GObject.GObject):
                 self.queue(*args)
 
         if len(self._async_active_pool) < self._max_async:
-            async_task = self._async_pool.pop(async_obj_id)
-            async_obj = async_task[0]
-            self._async_active_pool[async_obj_id] = async_obj
+            async_task_args = self._async_pool.pop(async_obj_id)
+            async_obj = async_task_args[0]
+            self._async_active_pool[async_obj_id] = async_task_args
 
             result_id = async_obj.connect("finished", on_async_finished)
-            async_obj.start(*args[1:])
+            async_obj.start(*async_task_args[1:])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]