Media Object preview when adding new photo with same name as deleted object shows preview of old object

I run Gramps 6.0.6 on Windows 11.

I had prepared a lot of photos which I added as Media Objects. But I found out that I had mixed up the filenames of two photos. So I deleted them from Gramps, renamed them, and added them again. But their preview in the Media list did not update.

I have recreated and simplified this situation, by creating two photo, one called A which is a picture of an A, and one photo called B, which is a picture of a B. I copy photo A into the Media Path of my Family Tree, but rename it to B. So photo B now contains a picture on an A. I add this photo as a Media Object. I then delete photo B from Gramps and also from the Media Path. I close Gramps and restart my PC. I copy the photo B containing a picture of a B into the Media Path. When I add B as Media Object, the preview shows an A.

I have installed the the Photo Tagging addon, which shows the correct preview.

If I add the photo to some objects Gallery, f.ex a Person, I have to select a subset of the image in the Media Reference Editor get an updated preview.

Is there a way to force Gramps to update the preview, when adding a new photo with a name same name which have been used before? (Is this a bug or a feature?)

It’s a bug. We need to delete the thumbnail when we delete the photo.

To fix this, I suggest running the ThumbnailGenerator tool which can be found in the third-party addons repository.

When doing some experimenting for this question by @svendoc posted yesterday on Facebook, the Thumbnail Generator was not resolving the problem. So I deleted the “Normal” and “Large” folders from the thumb folder and tried again. But then the Thumbnail Generator failed spectacularly with endless terminal messages about missing handles for media refs

Sorry, forgot to mention in the post: I have run the ThumbnailGenerator tool. Didn’t fix the problem.