darktable-org / darktable-org/darktable
Can't drop cache more than 1 time for an image
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 13.1k
- Forks
- 1.4k
- Avg merge
- 22h 14m
- Merged PRs (30d)
- 198
Description
Is there an existing issue for this?
- I checked and did not find my issue in the already reported ones
Describe the bug
Pursing a Lua solution to the pixls.us discussion https://discuss.pixls.us/t/can-i-force-the-refresh-of-a-file-in-darktable/48555.
My thought was to drop the cache for the image, then regenerate it.
This works the first time, but on second and later attempts the cache is not dropped
Troubleshot it down to
// due to DT_MIPMAP_BUFFER_DSC_FLAG_INVALIDATE, removes thumbnail from disc
+ fprintf(stderr, "removing from disk\n");
dt_cache_remove(&_get_cache(cache, mip)->cache, key);
}
else
{
+ fprintf(stderr, "took the else\n");
// ugly, but avoids alloc'ing thumb if it is not there.
_mipmap_cache_unlink_ondisk_thumbnail((&_get_cache(cache, mip)->cache)->cleanup_data, imgid, mip);
}
in src/common/mipmap_cache.c.
The first time I remove it, the code takes the dt_cache_remore() and the second time it takes the else and the cache is not removed.
Steps to reproduce
- import a non-raw into darktable
- open the image in gimp
- start the reload script
- make a change to the image in gimp and then select overwrite file to replace the image
- select the image in lighttable and click the reload button in actions on selected images module
- image cache is updated.
- make another change in gimp and overwrite again
- click the reload button and notice no update.
Expected behavior
The image cache should have dropped, so it could be recrated witht he updated image.
Logfile | Screenshot | Screencast
No response
Commit
No response
Where did you obtain darktable from?
self compiled
darktable version
current master
What OS are you using?
Linux
What is the version of your OS?
Ubuntu 22.04
Describe your system
gaming laptop i7
Are you using OpenCL GPU in darktable?
Yes
If yes, what is the GPU card and driver?
nvidia 3070ti latest
Please provide additional context if applicable. You can attach files too, but might need to rename to .txt or .zip
Here's the script,
Unzip it, drop the lua file in your lua scripts, then enable it from script_manager. It adds a button to the actions on selected images module to reload the cache for the selected image.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/common/mipmap_cache.c and reproduce the behavior using the attached reload.zip Lua script on an imported non-raw image. Trace the cache-removal path around DT_MIPMAP_BUFFER_DSC_FLAG_INVALIDATE and compare the first and subsequent reloads. Done means overwriting the image and reloading it repeatedly updates the image cache each time.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, lua
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100