Hello,
We are developing an image-manipulation app using latest stable releases
of SDL and SDL_image. On the Windows version, I have found a strange
problem regarding SDL_RWops.
Before loading an image, I verify its type like this:
This works great but when I stress-tested the application (hundreds of
images) I found that
at some point SDL_RWFromFile will always return NULL on any filename I
throw at it even though the same filenames worked just fine before. None
of the files are deleted, moved or written to while the program runs and
by the way I don’t use any threads. The only cure for this problem is to
restart the app. Then SDL will give me a valid RWops again.
Now I’m looking at the SDL source and see that SDL_RWFromFile is
basically just a wrapper for fopen(). What could be the problem? If you
had any ideas that would be great.
Hello,
We are developing an image-manipulation app using latest stable releases
of SDL and SDL_image. On the Windows version, I have found a strange
problem regarding SDL_RWops.
Before loading an image, I verify its type like this:
This works great but when I stress-tested the application (hundreds of
images) I found that
at some point SDL_RWFromFile will always return NULL on any filename I
throw at it even though the same filenames worked just fine before. None
of the files are deleted, moved or written to while the program runs and
by the way I don’t use any threads. The only cure for this problem is to
restart the app. Then SDL will give me a valid RWops again.
Now I’m looking at the SDL source and see that SDL_RWFromFile is
basically just a wrapper for fopen(). What could be the problem? If you
had any ideas that would be great.
Hello,
We are developing an image-manipulation app using latest stable releases
of SDL and SDL_image. On the Windows version, I have found a strange
problem regarding SDL_RWops.
Before loading an image, I verify its type like this:
This works great but when I stress-tested the application (hundreds of
images) I found that
at some point SDL_RWFromFile will always return NULL on any filename I
throw at it even though the same filenames worked just fine before.
Are you closing the rwop you get back? You could be running out of file handles…
-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment
Now I’m looking at the SDL source and see that SDL_RWFromFile is
basically just a wrapper for fopen(). What could be the problem? If you
had any ideas that would be great.
Are you closing the RWOps (that is, fclosing()) in the cases when you
can open it? I guess you’re running out of file descriptors.