Skip to content
This repository has been archived by the owner on Apr 2, 2020. It is now read-only.

Commit

Permalink
Fix XSLT file streams not being closed properly under new parallelisa…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
hach-que committed Jan 19, 2017
1 parent 6a1ced7 commit 20b46ef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Protobuild.Internal/BuildResources/ResourceProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private Stream LoadOverriddableResource(ResourceType resourceType, Language lang
if (File.Exists(path))
{
loadHash = "path:" + path;
source = File.Open(path, FileMode.Open);
source = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read);
break;
}
}
Expand Down Expand Up @@ -272,6 +272,7 @@ public XslCompiledTransform LoadXSLT(ResourceType resourceType, Language languag

var resolver = new EmbeddedResourceResolver();
var result = new XslCompiledTransform();
using (source)
using (var reader = XmlReader.Create(source))
{
try
Expand Down Expand Up @@ -318,12 +319,13 @@ public XslCompiledTransform LoadXSLT(ResourceType resourceType, Language languag
public XmlDocument LoadXML(ResourceType resourceType, Language language, string platform)
{
string loadHash;
var source = this.LoadOverriddableResource(resourceType, language, platform, out loadHash);

var document = new XmlDocument();
document.Load(source);
using (var source = this.LoadOverriddableResource(resourceType, language, platform, out loadHash))
{
var document = new XmlDocument();
document.Load(source);

return document;
return document;
}
}

private Stream GetTransparentDecompressionStream(Stream input)
Expand Down
Binary file modified Protobuild.exe
Binary file not shown.
Binary file modified Protobuild/Protobuild.Internal.dll.lzma
Binary file not shown.

0 comments on commit 20b46ef

Please sign in to comment.