diff --git a/src/Generation/Generator/Renderer/Public/ForeignTypedRecord.cs b/src/Generation/Generator/Renderer/Public/ForeignTypedRecord.cs index d94848157..e3531734c 100644 --- a/src/Generation/Generator/Renderer/Public/ForeignTypedRecord.cs +++ b/src/Generation/Generator/Renderer/Public/ForeignTypedRecord.cs @@ -24,7 +24,7 @@ namespace {Namespace.GetPublicName(record.Namespace)}; // AUTOGENERATED FILE - DO NOT MODIFY {PlatformSupportAttribute.Render(record as GirModel.PlatformDependent)} -public partial class {name} : GLib.BoxedRecord +public partial class {name} : GLib.BoxedRecord, IDisposable {{ public {internalHandleName} Handle {{ get; }} @@ -49,6 +49,11 @@ System.IntPtr GLib.BoxedRecord.GetHandle() }} {FunctionRenderer.Render(record.TypeFunction)} + + public void Dispose() + {{ + Handle.Dispose(); + }} }}"; } } diff --git a/src/Tests/Libs/Cairo-1.0.Tests/ContextTest.cs b/src/Tests/Libs/Cairo-1.0.Tests/ContextTest.cs index de8be76f2..b9fb49a67 100644 --- a/src/Tests/Libs/Cairo-1.0.Tests/ContextTest.cs +++ b/src/Tests/Libs/Cairo-1.0.Tests/ContextTest.cs @@ -1,4 +1,5 @@ -using FluentAssertions; +using System; +using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Cairo.Tests; @@ -6,6 +7,12 @@ namespace Cairo.Tests; [TestClass, TestCategory("UnitTest")] public class ContextTest : Test { + [TestMethod] + public void ImplementsIDisposable() + { + typeof(Context).Should().Implement(); + } + [TestMethod] public void BindingsShouldSucceed() {