From efd5d4bcf9fc15a92ef40e3f6edb185d190cd50e Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Tue, 19 Feb 2019 00:37:10 +0100 Subject: C#: Throw ObjectDisposedException from disposed wrapper classes --- modules/mono/glue/Managed/Files/RID.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'modules/mono/glue/Managed/Files/RID.cs') diff --git a/modules/mono/glue/Managed/Files/RID.cs b/modules/mono/glue/Managed/Files/RID.cs index b862b8cac0..c8564f7619 100644 --- a/modules/mono/glue/Managed/Files/RID.cs +++ b/modules/mono/glue/Managed/Files/RID.cs @@ -11,7 +11,13 @@ namespace Godot internal static IntPtr GetPtr(RID instance) { - return instance == null ? IntPtr.Zero : instance.ptr; + if (instance == null) + return IntPtr.Zero; + + if (instance.disposed) + throw new ObjectDisposedException(instance.GetType().FullName); + + return instance.ptr; } ~RID() -- cgit v1.2.3