]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/volume.cpp
fixing release handling of dc
[wxWidgets.git] / src / msw / volume.cpp
index fb471ddf5ff157dc25cc79c379151b381345e9ef..dbc6c61e55cc24a68ae84a15096e6c98032b0901 100644 (file)
@@ -33,6 +33,7 @@
     #endif
     #include "wx/intl.h"
     #include "wx/hashmap.h"
+    #include "wx/filefn.h"
 #endif // WX_PRECOMP
 
 #include "wx/dir.h"
@@ -264,6 +265,17 @@ static void BuildListFromNN(wxArrayString& list, NETRESOURCE* pResSrc,
                 {
                     wxString filename(pRes->lpRemoteName);
 
+                    // if the drive is unavailable, FilteredAdd() can hang for
+                    // a long time and, moreover, its failure appears to be not
+                    // cached so this will happen every time we use it, so try
+                    // a much quicker wxDirExists() test (which still hangs but
+                    // for much shorter time) for locally mapped drives first
+                    // to try to avoid this
+                    if ( pRes->lpLocalName &&
+                            *pRes->lpLocalName &&
+                                !wxDirExists(pRes->lpLocalName) )
+                        continue;
+
                     if (!filename.empty())
                     {
                         if (filename.Last() != '\\')