From f5b6f40bc40fe22f924e927591d945c8da6506a5 Mon Sep 17 00:00:00 2001 From: mattn Date: Thu, 26 Jun 2008 15:19:48 +0000 Subject: [PATCH] * fixed dir handle leaks for windows git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@284 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- radiant/missing.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/radiant/missing.cpp b/radiant/missing.cpp index 0245ec1e..f83bed3c 100644 --- a/radiant/missing.cpp +++ b/radiant/missing.cpp @@ -149,6 +149,7 @@ FindFiles::FindFiles( const char *_directory ) { FindFiles::~FindFiles() { if ( findHandle != NULL ) { closedir( findHandle ); + findHandle = NULL; } } @@ -173,8 +174,9 @@ FindFiles::FindFiles( const char *_directory ) { } FindFiles::~FindFiles() { - if ( findHandle != NULL ) { + if ( findHandle != INVALID_HANDLE_VALUE ) { FindClose( findHandle ); + findHandle = INVALID_HANDLE_VALUE; } } @@ -188,6 +190,7 @@ const char* FindFiles::NextFile() { } if ( FindNextFile( findHandle, &findFileData ) == 0 ) { FindClose( findHandle ); + findHandle = INVALID_HANDLE_VALUE; return NULL; } return findFileData.cFileName; -- 2.39.2