Split the different Destroy and Dispose signatures.
authorJarl Gullberg <jarl.gullberg@gmail.com>
Tue, 13 Jun 2017 20:42:52 +0000 (22:42 +0200)
committerJarl Gullberg <jarl.gullberg@gmail.com>
Tue, 13 Jun 2017 20:42:52 +0000 (22:42 +0200)
src/OpenTK.GLWidget/GLWidget.cs

index c1d3c5e..e2c0efa 100644 (file)
@@ -177,34 +177,47 @@ namespace OpenTK
             Dispose(false);
         }
 
-#if GTK3
         /// <summary>
         /// Destroys this <see cref="Widget"/>, disposing it and destroying it in the context of GTK.
         /// </summary>
         public override void Destroy()
-#else
+        {
+            GC.SuppressFinalize(this);
+            Dispose(true);
+
+            base.Destroy();
+        }
+
+#if !GTK3
         /// <summary>
         /// Disposes the current object, releasing any native resources it was using.
         /// </summary>
         /// <param name="disposing"></param>
         public override void Dispose()
-#endif
         {
             GC.SuppressFinalize(this);
             Dispose(true);
-#if GTK3
-            base.Destroy();
-#else
+
             base.Dispose();
-#endif
         }
+#endif
 
+#if GTK3
+        /// <summary>
+        /// Disposes the current object, releasing any native resources it was using.
+        /// </summary>
+        /// <param name="disposing"></param>
+        protected override void Dispose(bool disposing)
+        {
+            base.Dispose(disposing);
+#else
         /// <summary>
         /// Disposes the current object, releasing any native resources it was using.
         /// </summary>
         /// <param name="disposing"></param>
         public virtual void Dispose(bool disposing)
         {
+#endif
             if (disposing)
             {
                 _GraphicsContext.MakeCurrent(_WindowInfo);