* fixed dir handle leaks for windows

git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@284 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
mattn 2008-06-26 15:19:48 +00:00
parent d5fc00a4f8
commit f5b6f40bc4

View file

@ -149,6 +149,7 @@ FindFiles::FindFiles( const char *_directory ) {
FindFiles::~FindFiles() { FindFiles::~FindFiles() {
if ( findHandle != NULL ) { if ( findHandle != NULL ) {
closedir( findHandle ); closedir( findHandle );
findHandle = NULL;
} }
} }
@ -173,8 +174,9 @@ FindFiles::FindFiles( const char *_directory ) {
} }
FindFiles::~FindFiles() { FindFiles::~FindFiles() {
if ( findHandle != NULL ) { if ( findHandle != INVALID_HANDLE_VALUE ) {
FindClose( findHandle ); FindClose( findHandle );
findHandle = INVALID_HANDLE_VALUE;
} }
} }
@ -188,6 +190,7 @@ const char* FindFiles::NextFile() {
} }
if ( FindNextFile( findHandle, &findFileData ) == 0 ) { if ( FindNextFile( findHandle, &findFileData ) == 0 ) {
FindClose( findHandle ); FindClose( findHandle );
findHandle = INVALID_HANDLE_VALUE;
return NULL; return NULL;
} }
return findFileData.cFileName; return findFileData.cFileName;