Commit b983cdcf authored by Marinus Schraal's avatar Marinus Schraal

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
parent 961ae87c
Pipeline #45500 passed with stages
in 6 minutes and 33 seconds
......@@ -285,20 +285,19 @@ 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)
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment