When files are created in the currently opened directory, imgviewer might try to load the image before it have been fully written to disk. This cause the loading to fail and the image is not viewable.
simplefilewatcher (https://code.google.com/p/simplefilewatcher/) appears to be able to track changes to every file in the directory, try to use that instead and reload the images if they are changed. That will hopefully solve this. Otherwise try to reload failing images, or increase the wait before loading the directory changes?
Watching the directory for changes would likely improve the code clarity and performance as well, instead of reloading everything and patching it up to avoid it being noticed...
When files are created in the currently opened directory, imgviewer might try to load the image before it have been fully written to disk. This cause the loading to fail and the image is not viewable. simplefilewatcher (https://code.google.com/p/simplefilewatcher/) appears to be able to track changes to every file in the directory, try to use that instead and reload the images if they are changed. That will hopefully solve this. Otherwise try to reload failing images, or increase the wait before loading the directory changes?