Skip to content

Commit

Permalink
Fixed leaks which were causing generation to use too much memory.
Browse files Browse the repository at this point in the history
Signed-off-by: Dimitar Dobrev <[email protected]>
  • Loading branch information
ddobrev committed Dec 11, 2015
1 parent d279d68 commit 9f3d2f6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
16 changes: 9 additions & 7 deletions QtSharp.CLI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,16 @@ public static int Main(string[] args)
foreach (var libFile in libFiles)
{
parserOptions.FileName = libFile;
var parserResult = ClangParser.ParseLibrary(parserOptions);
if (parserResult.Kind == ParserResultKind.Success)
using (var parserResult = ClangParser.ParseLibrary(parserOptions))
{
dependencies[libFile] = CppSharp.ClangParser.ConvertLibrary(parserResult.Library).Dependencies;
}
else
{
dependencies[libFile] = Enumerable.Empty<string>();
if (parserResult.Kind == ParserResultKind.Success)
{
dependencies[libFile] = CppSharp.ClangParser.ConvertLibrary(parserResult.Library).Dependencies;
}
else
{
dependencies[libFile] = Enumerable.Empty<string>();
}
}
}
var modules = new List<string>
Expand Down
12 changes: 7 additions & 5 deletions QtSharp/CompileInlinesPass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ public override bool VisitLibrary(ASTContext library)
var parserOptions = new ParserOptions();
parserOptions.addLibraryDirs(dir);
parserOptions.FileName = inlines;
var parserResult = ClangParser.ParseLibrary(parserOptions);
if (parserResult.Kind == ParserResultKind.Success)
using (var parserResult = ClangParser.ParseLibrary(parserOptions))
{
var nativeLibrary = CppSharp.ClangParser.ConvertLibrary(parserResult.Library);
this.Driver.Symbols.Libraries.Add(nativeLibrary);
this.Driver.Symbols.IndexSymbols();
if (parserResult.Kind == ParserResultKind.Success)
{
var nativeLibrary = CppSharp.ClangParser.ConvertLibrary(parserResult.Library);
this.Driver.Symbols.Libraries.Add(nativeLibrary);
this.Driver.Symbols.IndexSymbols();
}
}
return true;
}
Expand Down
2 changes: 0 additions & 2 deletions QtSharp/Documentation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,6 @@ public void DocumentProperty(Property property)
var name = macroExpansion.Text.Split(' ')[1];
if (name == property.Name || name == alternativeName)
{
property.LineNumberStart = macroExpansion.LineNumberStart;
property.LineNumberEnd = macroExpansion.LineNumberEnd;
property.Name = name;
this.DocumentQtProperty(property);
return;
Expand Down

0 comments on commit 9f3d2f6

Please sign in to comment.