1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-07 15:49:42 +02:00

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 --- 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 @@ @@ -1161,7 +1161,8 @@
bool bool
wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite) wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite)
@ -10,12 +10,16 @@
{ {
wxLogSysError wxLogSysError
( (
@@ -1174,8 +1175,17 @@ @@ -1174,8 +1175,21 @@
#if !defined(__WXWINCE__) #if !defined(__WXWINCE__)
// Normal system call // Normal system call
- if ( wxRename (file1, file2) == 0 ) - if ( wxRename (file1, file2) == 0 )
- return true; - 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; + unsigned long doserrno = 0;
+ for (int i = 0; i < 2000; i++) + for (int i = 0; i < 2000; i++)
+ { + {
@ -23,7 +27,7 @@
+ return true; + return true;
+ unsigned long doserrno; + unsigned long doserrno;
+ _get_doserrno(&doserrno); + _get_doserrno(&doserrno);
+ if (doserrno != ERROR_ACCESS_DENIED && (doserrno == ERROR_ALREADY_EXISTS && exists)) + if (doserrno != ERROR_ACCESS_DENIED && (doserrno != ERROR_ALREADY_EXISTS || exists))
+ break; + break;
+ wxMilliSleep(1); + wxMilliSleep(1);
+ } + }

View File

@ -1175,6 +1175,10 @@ wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite)
#if !defined(__WXWINCE__) #if !defined(__WXWINCE__)
// Normal system call // 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; unsigned long doserrno = 0;
for (int i = 0; i < 2000; i++) for (int i = 0; i < 2000; i++)
{ {
@ -1182,7 +1186,7 @@ wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite)
return true; return true;
unsigned long doserrno; unsigned long doserrno;
_get_doserrno(&doserrno); _get_doserrno(&doserrno);
if (doserrno != ERROR_ACCESS_DENIED && (doserrno == ERROR_ALREADY_EXISTS && exists)) if (doserrno != ERROR_ACCESS_DENIED && (doserrno != ERROR_ALREADY_EXISTS || exists))
break; break;
wxMilliSleep(1); wxMilliSleep(1);
} }