mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-06-17 18:16:07 -05:00
Windows: fix favorite volume mount race
Copy selected favorite volumes into mount thread parameters so background mounting does not depend on mutable global vector storage. Also avoid unnecessary FavoriteVolume copies in auto-mount paths and fix mount-on-arrival state updates. Refs #1661
This commit is contained in:
@@ -290,7 +290,7 @@ namespace VeraCrypt
|
||||
{
|
||||
bMountFavoritesOnLogon = FALSE;
|
||||
|
||||
foreach (const FavoriteVolume &favorite, Favorites)
|
||||
for (const FavoriteVolume& favorite: Favorites)
|
||||
{
|
||||
if (favorite.MountOnLogOn)
|
||||
{
|
||||
@@ -301,7 +301,7 @@ namespace VeraCrypt
|
||||
|
||||
if (!bEnableBkgTask || bCloseBkgTaskWhenNoVolumes || IsNonInstallMode())
|
||||
{
|
||||
foreach (const FavoriteVolume favorite, Favorites)
|
||||
for (const FavoriteVolume& favorite: Favorites)
|
||||
{
|
||||
if (favorite.MountOnArrival)
|
||||
{
|
||||
@@ -482,7 +482,7 @@ namespace VeraCrypt
|
||||
AppendMenu (FavoriteVolumesMenu, MF_SEPARATOR, 0, L"");
|
||||
|
||||
int i = 0;
|
||||
foreach (const FavoriteVolume &favorite, FavoriteVolumes)
|
||||
for (const FavoriteVolume& favorite: FavoriteVolumes)
|
||||
{
|
||||
UINT flags = MF_STRING;
|
||||
|
||||
@@ -512,7 +512,7 @@ namespace VeraCrypt
|
||||
SendMessage (favoriteListControl, LVM_DELETEALLITEMS, 0, 0);
|
||||
|
||||
int line = 0;
|
||||
foreach (const FavoriteVolume favorite, favorites)
|
||||
for (const FavoriteVolume& favorite: favorites)
|
||||
{
|
||||
ListItemAdd (favoriteListControl, line, (wchar_t *) favorite.MountPoint.substr (0, 2).c_str());
|
||||
FillListControlSubItems (favoriteListControl, line++, favorite);
|
||||
@@ -533,7 +533,7 @@ namespace VeraCrypt
|
||||
|
||||
wstring GetFavoriteVolumeLabel (const wstring &volumePath, bool& useInExplorer)
|
||||
{
|
||||
foreach (const FavoriteVolume &favorite, FavoriteVolumes)
|
||||
for (const FavoriteVolume& favorite: FavoriteVolumes)
|
||||
{
|
||||
if (favorite.Path == volumePath)
|
||||
{
|
||||
@@ -542,7 +542,7 @@ namespace VeraCrypt
|
||||
}
|
||||
}
|
||||
|
||||
foreach (const FavoriteVolume &favorite, SystemFavoriteVolumes)
|
||||
for (const FavoriteVolume& favorite: SystemFavoriteVolumes)
|
||||
{
|
||||
if (favorite.Path == volumePath)
|
||||
{
|
||||
@@ -735,7 +735,7 @@ namespace VeraCrypt
|
||||
|
||||
FavoritesOnArrivalMountRequired.clear();
|
||||
|
||||
for (const FavoriteVolume favorite: FavoriteVolumes)
|
||||
for (const FavoriteVolume& favorite: FavoriteVolumes)
|
||||
{
|
||||
if (favorite.MountOnArrival)
|
||||
{
|
||||
@@ -745,7 +745,7 @@ namespace VeraCrypt
|
||||
{
|
||||
bool present = false;
|
||||
|
||||
for (const FavoriteVolume favoriteConnected: FavoritesMountedOnArrivalStillConnected)
|
||||
for (const FavoriteVolume& favoriteConnected: FavoritesMountedOnArrivalStillConnected)
|
||||
{
|
||||
if (favorite.Path == favoriteConnected.Path)
|
||||
{
|
||||
@@ -795,7 +795,7 @@ namespace VeraCrypt
|
||||
XmlWriteHeader (f);
|
||||
fputws (L"\n\t<favorites>", f);
|
||||
|
||||
foreach (const FavoriteVolume &favorite, favorites)
|
||||
for (const FavoriteVolume& favorite: favorites)
|
||||
{
|
||||
wchar_t tq[2048];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user