Races in TagDialog and Playlist::Model

Aneurin Price aneurin.price at gmail.com
Fri Mar 7 14:20:45 CET 2008


I've been working on getting tracks from the context view in the
correct order, for editing and/or adding to the playlist (I've got
some code which works, I think, but it's ... grotesque). In doing so,
I believe I've uncovered a couple of races.

In TagDialog, when constructed with a QueryMaker*, a data query and a
track query are run concurrently; it appears that if the data query
completes first, then dataQueryDone attempts to readTags() on tracks
which aren't there yet, causing a crash.

In Playlist::Model there's no crash, but it's possible for tracks to
be added in the wrong order, for example:
[1] Call insertOptioned(QueryMaker*, AddOptions) to add a full album
    -> A query is started
[2] Call insertOptioned(Meta::TrackList, AddOptions) to add an extra
couple of tracks
    -> The tracks are inserted
[3] The first query completes
    -> The album is inserted after the extra couple of tracks
Hence, method calls which add tracks to the playlist need to be serialised.

I don't know either of these areas well enough to be able to fix them,
but maybe the solution is obvious to somebody here?
(I'd be willing to work on this if somebody who knows those areas
could indicate how it should be done, I just don't really fancy
reading it all through a hundred times to grok it when it's probably
not too much of a problem for someone who already knows how these
work)

-- Nye


More information about the Amarok-devel mailing list