Skip to content

Commit

Permalink
Lock project when changing name
Browse files Browse the repository at this point in the history
  • Loading branch information
tjcouch-sil committed Jun 12, 2024
1 parent 9641ae8 commit 6626114
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions c-sharp/Projects/ParatextProjectDataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,18 +295,22 @@ public ResponseToRequest SetProjectSetting(string jsonKey, string value)
// https://github.com/ubsicap/Paratext/blob/aaadecd828a9b02e6f55d18e4c5dda8703ce2429/ParatextData/ScrText.cs#L259
if (paratextSettingName == ProjectSettings.PT_NAME)
{
// Don't set a lock because this is literally moving the whole folder (chances this will
// actually succeed are very slim as the project must only have Settings.xml and the
// ldml file for this not to instantly throw)
// Lock the whole project because this is literally moving the whole folder (chances
// this will actually succeed are very slim as the project must only have Settings.xml
// and the ldml file for this not to instantly throw)
// https://github.com/ubsicap/Paratext/blob/aaadecd828a9b02e6f55d18e4c5dda8703ce2429/ParatextData/ScrText.cs#L1793
try
{
scrText.Name = value;
}
catch (Exception ex)
{
errorMessage = ex.Message;
}
RunWithinLock(
WriteScope.EntireProject(scrText),
_ => {
try
{
scrText.Name = value;
}
catch (Exception ex)
{
errorMessage = ex.Message;
}
});
}
else
{
Expand Down

0 comments on commit 6626114

Please sign in to comment.