[gnome-music/wip/mschraal/tracker-critical-fixes] playlists: Fix Tracker criticals
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/tracker-critical-fixes] playlists: Fix Tracker criticals
- Date: Tue, 11 Dec 2018 10:35:28 +0000 (UTC)
commit b983cdcf279a491b2f5abd1028c73122943ee84b
Author: Marinus Schraal <mschraal gnome org>
Date: Tue Dec 11 11:25:43 2018 +0100
playlists: Fix Tracker criticals
An ordering issue in _static_playlist_query_cb resulted in critical
warnings being emitted. get_string was always called, regardless of a
result being available and the async operation being finished.
Only call get_string after next_finish returns with a result.
Closes: #251
gnomemusic/playlists.py | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/gnomemusic/playlists.py b/gnomemusic/playlists.py
index ad4d59c7..da427a6b 100644
--- a/gnomemusic/playlists.py
+++ b/gnomemusic/playlists.py
@@ -285,23 +285,22 @@ class Playlists(GObject.GObject):
return
def callback(cursor, res, final_query):
- uri = cursor.get_string(0)[0]
- final_query += Query.add_song_to_playlist(playlist.ID, uri)
-
+ has_next = False
try:
has_next = cursor.next_finish(res)
except GLib.Error as err:
logger.warning("Error: {}, {}".format(err.__class__, err))
- has_next = False
# Only perform the update when the cursor reached the end
if has_next:
- cursor.next_async(None, callback, final_query)
- return
+ uri = cursor.get_string(0)[0]
+ final_query += Query.add_song_to_playlist(playlist.ID, uri)
- self.tracker.update_blank_async(
- final_query, GLib.PRIORITY_LOW, None,
- self._static_playlist_update_finished, playlist)
+ cursor.next_async(None, callback, final_query)
+ else:
+ self.tracker.update_blank_async(
+ final_query, GLib.PRIORITY_LOW, None,
+ self._static_playlist_update_finished, playlist)
# Asynchronously form the playlist's final query
cursor.next_async(None, callback, final_query)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]