Skip to content

Conversation

badcel
Copy link
Member

@badcel badcel commented Feb 26, 2025

Interfaces can only be implemented by GObject classes not records. Every class inherits from GObject.Object which implements IDisposable. So implementing IDisposable on interfaces is possible.

In case of GirCore every instance of an object has a native counterpart. As the dotnet runtime does not know how big this native counterpart is the user should be able to explicitly dispose all instances which is easier if IDisposable is available on interfaces.

Fixes: #1202

  • I agree that my contribution may be licensed either under MIT or any version of LGPL license.

Interfaces can only be implemented by GObject classes not records. Every class inherits from GObject.Object which implements IDisposable. So implementing IDisposable on interfaces is possible.

In case of GirCore every instance of an object has a native counterpart. As the dotnet runtime does not know how big this native counterpart is the user should be able to explicitly dispose all instances which is easier if IDisposable is available on interfaces.

Fixes: #1202
@badcel badcel force-pushed the disposable-interfaces branch from f294ebc to 5a92b02 Compare February 26, 2025 16:08
@badcel badcel merged commit 41992a3 into main Feb 26, 2025
3 checks passed
@badcel badcel deleted the disposable-interfaces branch February 26, 2025 16:23
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.

IDisposable on interfaces
1 participant