Rawtherapee: Handle SVG updates in svg2png cache

Created on 26 Apr 2019  路  14Comments  路  Source: Beep6581/RawTherapee

As we've seen here https://github.com/Beep6581/RawTherapee/issues/5308#issuecomment-486791595 , having cached PNG images can lead to users having obsolete images and cause confusion whenever we update an SVG file. It will be a problem when users of 5.6 update to 5.7 and the splash screen still shows 5.6, and their icons are still those from 5.6.

I see three solutions:

  1. Delete svg2png on update. This is not a good option, as doing such a thing is not straight-forward across all the operating systems we support.
  2. Append the RT version in the svg2png (sub-)folder name. Every dev update will create a new sub-folder.
  3. Hash the source SVG image, and include the first few characters of the hash in the resulting PNG filename. RawTherapee would then hash each SVG file and see if a corresponding PNG file with that hash exists, and only generate a new one if it does not. Optionally this could use something like our release notes mechanism so that it gets triggered only when a new git tag is made.
patch provided GUI bug

Most helpful comment

@Hombre57
resize_20190905_111349
:sob:

All 14 comments

@Beep6581

N掳1 would be fine for me. RT does delete the unused svg2png sub-folders on exit, so I hope it works on all platform. We could do that check with the Options::firstrun parameter. If that wouldn't have solved the bug, a better first run parameter could be based on the build timestamp (optionnaly activated by CMake) ?

@Hombre57 I don't see Options::firstrun in the dev code, but the suggestion sounds good. I assume a change of options.version would be considered a first run? It wouldn't even need to parse the version in any way, just check for a match.

We are about to crash into this issue:

when users of 5.6 update to 5.7 and the splash screen still shows 5.6

@Beep6581 Do you mean it has became top priority ?

[Edit] Just saw that it's flagged 5.7... I'm looking at this now.

@Beep6581 Just for the record, if new release means new cache directory (e.g. "RawTherapee5.7"), then all icons will be rebuilt. The problem arise when the cache folder has the same name for new versions. It won't be a problem for Windows, but I don't know cache names for other OS.

I'm working on this and will post a patch in a new branch tomorrow. It will delete the cache when minor version changes, at least.

@Beep6581 Patch provided in cleared-icon-cache branch in commit 500fac34cd539e60ecb1788226d5de25b68cf05a.

The version value from the Options file is compared to the hardcoded value (computed at build time) of the running application. If the major or minor version is different, the svg2png folder is cleaned at startup-time.

if new release means new cache directory (e.g. "RawTherapee5.7"), then all icons will be rebuilt.

Yup, but this is outside of our control, and most likely doesn't change. Solution 1 (delete svg2png on update) is also outside of our control, and probably not even possible in Linux.

Patch provided

@Hombre57 great :) I will test ASAP.

Compiling takes forever... will get back tomorrow, and tag 5.7-rc1 tomorrow evening.

@Beep6581 Don't you use the -j option ?

@Hombre57
resize_20190905_111349
:sob:

@Hombre57 fix confirmed :+1:

Don't you use the -j option ?

Didn't thought it would be that funny, but nevermind... :thinking:

I'll commit in the evening then.

@Hombre57

$ uname -p
Intel(R) Core(TM) m3-6Y30 CPU @ 0.90GHz

@Beep6581 Ah, ok, understood :sweat_smile:

Branch merged to dev.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

heckflosse picture heckflosse  路  5Comments

heckflosse picture heckflosse  路  4Comments

Beep6581 picture Beep6581  路  4Comments

elecprog picture elecprog  路  5Comments

heckflosse picture heckflosse  路  3Comments