1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Put a lock around GetOutputFileNames

This commit is contained in:
Brian Fiete 2022-05-13 13:24:32 -07:00
parent d62a78fe74
commit 2c1d38d45f
3 changed files with 14 additions and 1 deletions

View file

@ -1262,6 +1262,9 @@ namespace IDE
Workspace.Options workspaceOptions = gApp.GetCurWorkspaceOptions(); Workspace.Options workspaceOptions = gApp.GetCurWorkspaceOptions();
BfCompiler bfCompiler = gApp.mBfBuildCompiler; BfCompiler bfCompiler = gApp.mBfBuildCompiler;
BfSystem bfSystem = gApp.mBfBuildSystem;
bfSystem.Lock(0);
var bfProject = gApp.mBfBuildSystem.mProjectMap[project]; var bfProject = gApp.mBfBuildSystem.mProjectMap[project];
bool bfHadOutputChanges = false; bool bfHadOutputChanges = false;
List<String> bfFileNames = scope List<String>(); List<String> bfFileNames = scope List<String>();
@ -1284,6 +1287,8 @@ namespace IDE
bfCompiler.GetOutputFileNames(bfProject, .FlushQueuedHotFiles, out bfHadOutputChanges, bfFileNames); bfCompiler.GetOutputFileNames(bfProject, .FlushQueuedHotFiles, out bfHadOutputChanges, bfFileNames);
defer:: ClearAndDeleteItems(bfFileNames); defer:: ClearAndDeleteItems(bfFileNames);
} }
bfSystem.Unlock();
if (bfHadOutputChanges) if (bfHadOutputChanges)
project.mNeedsTargetRebuild = true; project.mNeedsTargetRebuild = true;

View file

@ -10400,10 +10400,16 @@ namespace IDE
return; return;
BfCompiler bfCompiler = mBfBuildCompiler; BfCompiler bfCompiler = mBfBuildCompiler;
BfSystem bfSystem = mBfBuildSystem;
var bfProject = mBfBuildSystem.mProjectMap[project]; var bfProject = mBfBuildSystem.mProjectMap[project];
bool bfHadOutputChanges; bool bfHadOutputChanges;
List<String> bfFileNames = scope List<String>(); List<String> bfFileNames = scope List<String>();
bfSystem.Lock(0);
bfCompiler.GetOutputFileNames(bfProject, .None, out bfHadOutputChanges, bfFileNames); bfCompiler.GetOutputFileNames(bfProject, .None, out bfHadOutputChanges, bfFileNames);
bfSystem.Unlock();
defer ClearAndDeleteItems(bfFileNames); defer ClearAndDeleteItems(bfFileNames);
if (bfHadOutputChanges) if (bfHadOutputChanges)
project.mNeedsTargetRebuild = true; project.mNeedsTargetRebuild = true;

View file

@ -10431,8 +10431,10 @@ enum BfUsedOutputFlags
BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetUsedOutputFileNames(BfCompiler* bfCompiler, BfProject* bfProject, BfUsedOutputFlags flags, bool* hadOutputChanges) BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetUsedOutputFileNames(BfCompiler* bfCompiler, BfProject* bfProject, BfUsedOutputFlags flags, bool* hadOutputChanges)
{ {
BP_ZONE("BfCompiler_GetUsedOutputFileNames"); bfCompiler->mSystem->AssertWeHaveLock();
BP_ZONE("BfCompiler_GetUsedOutputFileNames");
*hadOutputChanges = false; *hadOutputChanges = false;
String& outString = *gTLStrReturn.Get(); String& outString = *gTLStrReturn.Get();
outString.clear(); outString.clear();