Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interfaces should implement IDisposable #1203

Merged
merged 1 commit into from
Feb 26, 2025
Merged

Interfaces should implement IDisposable #1203

merged 1 commit into from
Feb 26, 2025

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