From ef527f83fcdc9d48fe7d655c35fdfef951a2a397 Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Mon, 21 Dec 2015 16:59:46 -0600 Subject: [PATCH] Revised workaround for bug #1266 --- win/wxWidgets_additions/fix_rename.diff | 12 ++++++++---- .../wxWidgets-3.0.2/src/common/filefn.cpp | 8 ++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/win/wxWidgets_additions/fix_rename.diff b/win/wxWidgets_additions/fix_rename.diff index 7014439fb..19adc6f01 100644 --- a/win/wxWidgets_additions/fix_rename.diff +++ b/win/wxWidgets_additions/fix_rename.diff @@ -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 diff --git a/win/wxWidgets_additions/wxWidgets-3.0.2/src/common/filefn.cpp b/win/wxWidgets_additions/wxWidgets-3.0.2/src/common/filefn.cpp index fbef7faba..a1e781c21 100644 --- a/win/wxWidgets_additions/wxWidgets-3.0.2/src/common/filefn.cpp +++ b/win/wxWidgets_additions/wxWidgets-3.0.2/src/common/filefn.cpp @@ -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