From 3d60cf2bf6b64d35bcf039eb52c48cc757a7ed66 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:42:52 +0200 Subject: [PATCH] Split the different Destroy and Dispose signatures. --- src/OpenTK.GLWidget/GLWidget.cs | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index c1d3c5e..e2c0efa 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -177,34 +177,47 @@ namespace OpenTK Dispose(false); } -#if GTK3 /// /// Destroys this , disposing it and destroying it in the context of GTK. /// public override void Destroy() -#else + { + GC.SuppressFinalize(this); + Dispose(true); + + base.Destroy(); + } + +#if !GTK3 /// /// Disposes the current object, releasing any native resources it was using. /// /// public override void Dispose() -#endif { GC.SuppressFinalize(this); Dispose(true); -#if GTK3 - base.Destroy(); -#else + base.Dispose(); -#endif } +#endif +#if GTK3 + /// + /// Disposes the current object, releasing any native resources it was using. + /// + /// + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); +#else /// /// Disposes the current object, releasing any native resources it was using. /// /// public virtual void Dispose(bool disposing) { +#endif if (disposing) { _GraphicsContext.MakeCurrent(_WindowInfo); -- 2.7.4