hopefully fix awful movie handle leaks

This commit is contained in:
gocha 2009-12-15 01:39:35 +00:00
parent aa840c41ca
commit 3bec8d8d00
1 changed files with 3 additions and 1 deletions

View File

@ -458,6 +458,7 @@ const char* _CDECL_ FCEUI_LoadMovie(const char *fname, bool _read_only, bool tas
opened = true; opened = true;
// } // }
// fs.close(); // fs.close();
delete fp;
// } // }
if(!opened) if(!opened)
{ {
@ -465,6 +466,7 @@ const char* _CDECL_ FCEUI_LoadMovie(const char *fname, bool _read_only, bool tas
// fstream fs (fname, std::ios_base::in); // fstream fs (fname, std::ios_base::in);
loadedfm2 = LoadFM2(currMovieData, fp, INT_MAX, false); loadedfm2 = LoadFM2(currMovieData, fp, INT_MAX, false);
// fs.close(); // fs.close();
delete fp;
} }
if(!loadedfm2) if(!loadedfm2)
@ -1093,7 +1095,7 @@ void FCEUI_MakeBackupMovie(bool dispMessage)
MovieData md = currMovieData; //Get current movie data MovieData md = currMovieData; //Get current movie data
EMUFILE* outf = new EMUFILE_FILE(backupFn.c_str(),"wb"); //FCEUD_UTF8_fstream(backupFn, "wb"); //open/create file EMUFILE* outf = new EMUFILE_FILE(backupFn.c_str(),"wb"); //FCEUD_UTF8_fstream(backupFn, "wb"); //open/create file
md.dump(outf,false); //dump movie data md.dump(outf,false); //dump movie data
// delete outf; //clean up, delete file object delete outf; //clean up, delete file object
//TODO, decide if fstream successfully opened the file and print error message if it doesn't //TODO, decide if fstream successfully opened the file and print error message if it doesn't