mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-24 14:45:53 +00:00
Make sure to retry when loading an image that's been refreshed
* Fixes a potential race if a change is detected while some other program has an exclusive lock on the file to write it, and we try to open before it's possible. A slow retry fixes that.
This commit is contained in:
@@ -297,7 +297,20 @@ ReplayCreateStatus IMG_CreateReplayDevice(const char *logfile, IReplayDriver **d
|
||||
|
||||
void ImageViewer::RefreshFile()
|
||||
{
|
||||
FILE *f = FileIO::fopen(m_Filename.c_str(), "rb");
|
||||
FILE *f = NULL;
|
||||
|
||||
for(int attempt=0; attempt < 10 && f == NULL; attempt++)
|
||||
{
|
||||
f = FileIO::fopen(m_Filename.c_str(), "rb");
|
||||
if(f)
|
||||
break;
|
||||
Threading::Sleep(400);
|
||||
}
|
||||
|
||||
if(!f)
|
||||
{
|
||||
RDCERR("Couldn't open file! Exclusive lock elsewhere?");
|
||||
}
|
||||
|
||||
FetchTexture texDetails;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user