Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #233: TryGetObject threws. #237

Merged
merged 5 commits into from
Feb 21, 2020

Conversation

Arkatufus
Copy link
Contributor

Closes #233
Bug was caused by multiple threads accessing the Config.Root property and Config.Root was not thread-safe.

Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are Root and Value effectively the same?

@@ -42,6 +42,7 @@ protected Config()
protected Config(HoconValue value)
{
Value = (HoconValue)value.Clone(null);
Root = (HoconValue)value.Clone(null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Root == Value ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, they're different instances, the original value is cloned twice, one to the Value property, the second is into the Root property.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but at this point of the code, they are Equal, but not ReferenceEqual

@@ -90,25 +93,7 @@ public Config(HoconRoot root, Config fallback) : this(root)
/// </summary>
public virtual bool IsEmpty => Value == EmptyValue && _fallbacks.Count == 0;

protected HoconValue _mergedValueCache = null;
public HoconValue Root
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


_mergedValueCache = null;
return result;
return new Config(this, fallback);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HoconValue.TryGetObject can throw System.ArgumentNullException
2 participants