File tree Expand file tree Collapse file tree
cpp/autobuilder/Semmle.Autobuild.Cpp Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ static int Main()
1717 try
1818 {
1919 Console . WriteLine ( "CodeQL C++ autobuilder" ) ;
20- var builder = new CppAutobuilder ( actions , options ) ;
20+ using var builder = new CppAutobuilder ( actions , options ) ;
2121 return builder . AttemptBuild ( ) ;
2222 }
2323 catch ( InvalidEnvironmentException ex )
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ public static int Main()
1717 try
1818 {
1919 Console . WriteLine ( "CodeQL C# autobuilder" ) ;
20- var builder = new CSharpAutobuilder ( actions , options ) ;
20+ using var builder = new CSharpAutobuilder ( actions , options ) ;
2121 return builder . AttemptBuild ( ) ;
2222 }
2323 catch ( InvalidEnvironmentException ex )
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ public interface IAutobuilder<out TAutobuildOptions> where TAutobuildOptions : A
9292 /// The overall design is intended to be extensible so that in theory,
9393 /// it should be possible to add new build rules without touching this code.
9494 /// </summary>
95- public abstract class Autobuilder < TAutobuildOptions > : IAutobuilder < TAutobuildOptions > where TAutobuildOptions : AutobuildOptionsShared
95+ public abstract class Autobuilder < TAutobuildOptions > : IDisposable , IAutobuilder < TAutobuildOptions > where TAutobuildOptions : AutobuildOptionsShared
9696 {
9797 /// <summary>
9898 /// Full file paths of files found in the project directory, as well as
@@ -351,6 +351,20 @@ protected BuildScript AutobuildFailure() =>
351351 }
352352 } ) ;
353353
354+ public void Dispose ( )
355+ {
356+ Dispose ( true ) ;
357+ GC . SuppressFinalize ( this ) ;
358+ }
359+
360+ protected virtual void Dispose ( bool disposing )
361+ {
362+ if ( disposing )
363+ {
364+ ( diagnostics as IDisposable ) ? . Dispose ( ) ;
365+ }
366+ }
367+
354368 /// <summary>
355369 /// Value of CODEQL_EXTRACTOR_<LANG>_ROOT environment variable.
356370 /// </summary>
You can’t perform that action at this time.
0 commit comments