Previously opened NEF-file can't be moved or deleted until RawTherapee is closed.
Version: 5.1
OS: MS Windows 10 Pro Build 15063
CPU: Intel i7 4790K @4Ghz
Memory: 16GB
Downloaded http://rawtherapee.com/releases_head/windows/RawTherapee_5.1_WinVista_64.zip
Open .NEF-file in RawTherapee 5.1.
Close .NEF-file.
The .NEF-file can't be moved or deleted until RawTherapee is closed.

Please don't crop screenshots.
Are you working in METM or SETM?
Cannot reproduce in Linux.
Oh, sorry about the crop.
Not sure what METM or SETM means so I guess no is the right answer :)
They're editor tab modes:
http://rawpedia.rawtherapee.com/The_Image_Editor_Tab#Editor_Tab_Modes
See Preferences > General > Layout, the default is SETM,VT
Ah, OK.
METM then.
Bug confirmed on win7/64. Also for SETM and CR2 files. Works fine with jpgs.
I take this one though I'm not sure if I will find the culprit.
When building without MMAP support it works fine. That will make it easier to find the culprit.
I feel the need to discuss why mmap is still used for loading raw files.
@Floessie @agriggio Any thoughts from you?
@heckflosse Ingo, I'm sure you wouldn't ask, if you had not benchmarked it. :smile: Theoretically mmapping should be faster. Have you checked the return value of UnmapViewOfFile()? The rest looks sane to me, although I'm not familiar with the Win API.
The file was opened twice but closed only once.
This fixes it:
diff --git a/rtengine/rawimage.cc b/rtengine/rawimage.cc
index d8dc7eb1..7b6ee878 100644
--- a/rtengine/rawimage.cc
+++ b/rtengine/rawimage.cc
@@ -39,6 +39,7 @@ RawImage::~RawImage()
{
if(ifp) {
fclose(ifp);
+ ifp = nullptr;
}
if( image ) {
@@ -410,7 +411,11 @@ int RawImage::loadRaw (bool loadData, unsigned int imageNum, bool closeFile, Pro
verbose = settings->verbose;
oprof = nullptr;
- ifp = gfopen (ifname); // Maps to either file map or direct fopen
+ if(!ifp) {
+ ifp = gfopen (ifname); // Maps to either file map or direct fopen
+ } else {
+ fseek (ifp, 0, SEEK_SET);
+ }
if (!ifp) {
return 3;
I would appreciate if someone could test the patch on Linux before I push it :)
I compiled in Linux using the patch and opened 1.pef and then switched to 2.pef. I deleted both files and associated PP3 files while RawTherapee was running and 2.pef was still open in the Editor. This is the same behavior as before the patch. I then switched to 3.pef and closed RT. No problems.