How to reproduce: - Start PV and load an .sr file, then run a PD on the data. E.g. jtag/olimex_stm32-h103/olimex_stm32-h103_idle.sr, add the JTAG decoder. Look at the colors of the first few annotations in the file. - Shutdown PV, start PV again, load the *same* .sr file, add the same JTAG decoder. The colors of the first few annotations will now be *different* than before. This shouldn't happen and is confusing for the user. If settings/data stay the same, so should be annotation class colors.
The color is determined here: http://sigrok.org/gitweb/?p=pulseview.git;a=blob;f=pv/view/decodetrace.cpp;h=95e0e5e9ef0f2d4ddfd0692da1ab478846351190;hb=HEAD#l216 As the address of "this" is included in the hash, the color is pretty much random.
Not quite as trivial to fix as I thought, will need to give it more thought. Reason is that the has function is really crappy and will create collisions (i.e. identical or visually identical colors) like crazy. Currently I'm leaning towards kicking the hash function out and using a HSV-based algorithm instead, using different starting offsets into the hue range.
Fixed in 9ba13f5e933f55f015e7c592980dfad14b4c66a8, thanks!