1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 16:10:06 +02:00

Lift call to CreateSingleInstanceChecker out of InitTempDir

This commit is contained in:
Paul Licameli 2020-12-01 21:17:12 -05:00
parent 55ad1b43b8
commit 596032c42f

View File

@ -1269,6 +1269,17 @@ bool AudacityApp::OnInit()
return false;
}
// Make sure the temp dir isn't locked by another process.
{
auto key =
PreferenceKey(FileNames::Operation::Temp, FileNames::PathType::_None);
auto temp = gPrefs->Read(key);
if (temp.empty() || !CreateSingleInstanceChecker(temp)) {
FinishPreferences();
return false;
}
}
//<<<< Try to avoid dialogs before this point.
// The reason is that InitTempDir starts the single instance checker.
// If we're waiitng in a dialog before then we can very easily
@ -1640,10 +1651,6 @@ bool AudacityApp::InitTempDir()
FileNames::ResetTempDir();
FileNames::UpdateDefaultPath(FileNames::Operation::Temp, temp);
// Make sure the temp dir isn't locked by another process.
if (!CreateSingleInstanceChecker(temp))
return false;
return true;
}