DirManager::ProjectFSCK (project check):
Made the enumerations interleaved with handling, because,
for example, user choosing to replace missing aliased block files with silence
needs to put in SilentBlockFiles and delete the corresponding auf files,
so those would then not be cumulated in missingAliasBlockFileHash.
We still do the FindX methods outside the conditionals,
so the log always shows all found errors.
Moved check for orphan files to last, so user first has a chance to get
messages about missing files that user may have mistakenly renamed
(and the renamed ones would appear to be orphans).
Re-ordered user choices for orphan files dialog to safest-to-boldest.
Changed FSCKstatus_CLOSEREQ and FSCKstatus_CHANGED to be integers rather
than binary flags. They were never returned with both in the result, nor used that way.
Made the project check log warnings use full paths instead of just file names.
Removed close box and system menu from MultiDialog, so that project check dialogs cannot just be closed. User has to decide on one of the choices.
Fixed some handling in AudacityProject::OnShowLog(). If the log was already showing before MultiDialog came up, it froze because it was not re-enabled.
Added a "Show Log for Details" button to MultiDialog so it does what the comments say, i.e., allows the user to look in the log to see which files are problematic (e.g., orphaned blockfiles.
Tightened up ProjectFSCK messages.
Added comments about remaining (long-standing!) problems in ProjectFSCK.
Was able to make the bug occur after lots of fast clicking around, by double-clicking Preview in Amplify dialog.
The key seems to be the call to wxYield. That function is obsolete, but looking at the documentation for its successor, wxApp::Yield():
"Caution should be exercised, however, since yielding may allow the user to perform actions which are not compatible with the current task. Disabling menu items or whole menus during processing can avoid unwanted reentrance of code: see ::wxSafeYield for a better function."
That sounds like exactly the situations where this has occurred. And the documentation for ::wxSafeYieldsays:
"This function is similar to wxYield, except that it disables the user input to all program windows before calling wxYield and re-enables it again afterwards."
Sounds like what we need. So I went through the code and for all the wxYield and wxGetApp()::Yield occurrences where Audacity is doing some drawing or already in the process of responding to a GUI event, I replaced them with ::wxSafeYield. Replaced all the remaining wxYield calls with calls to wxGetApp()::Yield().
Haven't been able to replicate the bug since these changes. Please test.
final but it's a big improvement. Reversed a couple changes from
original indication scheme that are no longer necessary. Unfortunately
it's really hard to remove colors from AllThemeResources.h.