Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Commit 31d2d48

Browse files
committed
[Core] Fixes #422. Added synchronization between Bam.Core.TokenizedString.IsParsed and Bam.Core.TokenizedString.Parse().
1 parent e1042a0 commit 31d2d48

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Bam.Core/TokenizedString.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ private enum EFlags
122122
private Module ModuleWithMacros = null;
123123
private string OriginalString = null;
124124
private string ParsedString = null;
125+
private readonly object ParsedStringGuard = new object(); // since you can't lock ParsedString as it may be null
125126
private bool Verbatim;
126127
private TokenizedStringArray PositionalTokens = null;
127128
private string CreationStackTrace = null;
@@ -426,8 +427,11 @@ public bool IsParsed
426427
return false;
427428
}
428429
var hasTokens = (null != this.Tokens);
429-
var hasParsedString = (null != this.ParsedString);
430-
return !hasTokens && hasParsedString;
430+
lock (this.ParsedStringGuard)
431+
{
432+
var hasParsedString = (null != this.ParsedString);
433+
return !hasTokens && hasParsedString;
434+
}
431435
}
432436
}
433437

@@ -531,7 +535,10 @@ public void
531535
this.parsedStackTrace,
532536
AllStringsParsed ? " after the string parsing phase" : string.Empty);
533537
}
534-
this.ParseInternalWithAlreadyParsedCheck(null);
538+
lock (this.ParsedStringGuard)
539+
{
540+
this.ParseInternalWithAlreadyParsedCheck(null);
541+
}
535542
lock (StringsForParsing)
536543
{
537544
StringsForParsing.Remove(this);

Changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
20-Jan-2018 Fixes #422. Added synchronization between Bam.Core.TokenizedString.IsParsed and Bam.Core.TokenizedString.Parse().
2+
13
20-Jan-2018 Fixes #421. Publisher.Collation.IncludeAllModulesInNamespace now only includes modules that generate the specified pathkey.
24

35
20-Jan-2018 Fixes #420. Container source modules which are passed into C[.Cxx].ConsoleApplication.ExtendSource() should not standalone compile, as there is no guarantee that they have sufficient dependencies in order to compile. The applications consuming them may provide those dependencies.

0 commit comments

Comments
 (0)