X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/76432737a59e25cd508d817e2dac63c3c03032a1..2ac013b1a5d8210ab0c53f7eb9687399b9312162:/src/msw/volume.cpp diff --git a/src/msw/volume.cpp b/src/msw/volume.cpp index bb81bbf9e9..628dc4e66c 100644 --- a/src/msw/volume.cpp +++ b/src/msw/volume.cpp @@ -41,6 +41,16 @@ #include "wx/volume.h" +#include + +#ifndef SHGetFileInfo +#ifdef UNICODE +#define SHGetFileInfo SHGetFileInfoW +#else +#define SHGetFileInfo SHGetFileInfoA +#endif +#endif + #ifndef SHGFI_ATTRIBUTES #define SHGFI_ATTRIBUTES 2048 #endif @@ -92,7 +102,7 @@ static WNetCloseEnumPtr s_pWNetCloseEnum; //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ static long s_cancelSearch = FALSE; -struct FileInfo : public wxObject +struct FileInfo { FileInfo(unsigned flag=0, wxFSVolumeKind type=wxFS_VOL_OTHER) : m_flags(flag), m_type(type) {} @@ -109,7 +119,14 @@ struct FileInfo : public wxObject wxFSVolumeKind m_type; }; WX_DECLARE_STRING_HASH_MAP(FileInfo, FileInfoMap); -static FileInfoMap s_fileInfo(25); +// Cygwin bug (?) destructor for global s_fileInfo is called twice... +static FileInfoMap& GetFileInfoMap() +{ + static FileInfoMap s_fileInfo(25); + + return s_fileInfo; +} +#define s_fileInfo (GetFileInfoMap()) //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Other initialization. @@ -412,7 +429,7 @@ wxArrayString wxFSVolume::GetVolumes(int flagsSet, int flagsUnset) { #ifdef UNICODE s_pWNetOpenEnum = (WNetOpenEnumPtr)s_mprLib.GetSymbol(_T("WNetOpenEnumW")); - s_pWNetEnumResource = (WNetEnumResourcePtr)s_mprLib.GetSymbol("WNetEnumResourceW"); + s_pWNetEnumResource = (WNetEnumResourcePtr)s_mprLib.GetSymbol(_T("WNetEnumResourceW")); #else s_pWNetOpenEnum = (WNetOpenEnumPtr)s_mprLib.GetSymbol(_T("WNetOpenEnumA")); s_pWNetEnumResource = (WNetEnumResourcePtr)s_mprLib.GetSymbol(_T("WNetEnumResourceA"));