Revised workaround for bug #1266

This commit is contained in:
Leland Lucius 2015-12-21 16:59:46 -06:00
parent d6297ed01d
commit ef527f83fc
2 changed files with 14 additions and 6 deletions

View File

@ -1,5 +1,5 @@
--- orig/wxWidgets-3.0.2/src/common/filefn.cpp 2014-10-06 16:33:44.000000000 -0500
+++ wxWidgets-3.0.2/src/common/filefn.cpp 2015-12-21 03:00:28.542150200 -0600
+++ wxWidgets-3.0.2/src/common/filefn.cpp 2015-12-21 16:54:57.998187800 -0600
@@ -1161,7 +1161,8 @@
bool
wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite)
@ -10,12 +10,16 @@
{
wxLogSysError
(
@@ -1174,8 +1175,17 @@
@@ -1174,8 +1175,21 @@
#if !defined(__WXWINCE__)
// Normal system call
- if ( wxRename (file1, file2) == 0 )
- return true;
+ //
+ // For explanation, see: (warning...based mostly on observed behavior)
+ // http://bugzilla.audacityteam.org/show_bug.cgi?id=1266
+ // https://github.com/audacity/audacity/pull/94
+ unsigned long doserrno = 0;
+ for (int i = 0; i < 2000; i++)
+ {
@ -23,8 +27,8 @@
+ return true;
+ unsigned long doserrno;
+ _get_doserrno(&doserrno);
+ if (doserrno != ERROR_ACCESS_DENIED && (doserrno == ERROR_ALREADY_EXISTS && exists))
+ break;
+ if (doserrno != ERROR_ACCESS_DENIED && (doserrno != ERROR_ALREADY_EXISTS || exists))
+ break;
+ wxMilliSleep(1);
+ }
#endif

View File

@ -1175,6 +1175,10 @@ wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite)
#if !defined(__WXWINCE__)
// Normal system call
//
// For explanation, see: (warning...based mostly on observed behavior)
// http://bugzilla.audacityteam.org/show_bug.cgi?id=1266
// https://github.com/audacity/audacity/pull/94
unsigned long doserrno = 0;
for (int i = 0; i < 2000; i++)
{
@ -1182,8 +1186,8 @@ wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite)
return true;
unsigned long doserrno;
_get_doserrno(&doserrno);
if (doserrno != ERROR_ACCESS_DENIED && (doserrno == ERROR_ALREADY_EXISTS && exists))
break;
if (doserrno != ERROR_ACCESS_DENIED && (doserrno != ERROR_ALREADY_EXISTS || exists))
break;
wxMilliSleep(1);
}
#endif