mirror of https://github.com/snes9xgit/snes9x.git
Change movie file handle closing to fix win32 crash
This commit is contained in:
parent
b478002bfe
commit
54f8a1fd96
|
@ -807,6 +807,8 @@ int S9xMovieOpen (const char *filename, bool8 read_only)
|
|||
restore_movie_settings();
|
||||
|
||||
lseek(fn, Movie.SaveStateOffset, SEEK_SET);
|
||||
|
||||
// reopen stream to access as gzipped data
|
||||
stream = REOPEN_STREAM(fn, "rb");
|
||||
if (!stream)
|
||||
return (FILE_NOT_FOUND);
|
||||
|
@ -820,7 +822,11 @@ int S9xMovieOpen (const char *filename, bool8 read_only)
|
|||
else
|
||||
result = S9xUnfreezeFromStream(stream);
|
||||
|
||||
CLOSE_STREAM(stream);
|
||||
// do not close stream but close FILE *
|
||||
// (msvcrt will try to close all open FILE *handles on exit - if we do CLOSE_STREAM here
|
||||
// the underlying file will be closed by zlib, causing problems when msvcrt tries to do it)
|
||||
delete stream;
|
||||
fclose(fd);
|
||||
|
||||
if (result != SUCCESS)
|
||||
return (result);
|
||||
|
|
Loading…
Reference in New Issue