[OpenTK] Removed the finalizer in OpenTK.Toolkit
authorthefiddler <stapostol@gmail.com>
Wed, 23 Jul 2014 19:22:22 +0000 (21:22 +0200)
committerthefiddler <stapostol@gmail.com>
Wed, 23 Jul 2014 19:22:22 +0000 (21:22 +0200)
This resolves crashes related to the platform factory being reset while
resources are still live.

Source/OpenTK/Toolkit.cs

index 5839a90..0699d5b 100644 (file)
@@ -178,22 +178,19 @@ namespace OpenTK
                     }
                 }
             }
-            else
-            {
-                Debug.Print("OpenTK.Toolkit leaked, did you forget to call Dispose()?");
-                platform_factory = null;
-                toolkit = null;
-                initialized = false;
-            }
         }
 
+        #if DEBUG
         /// <summary>
         /// Finalizes this instance.
         /// </summary>
         ~Toolkit()
         {
-            Dispose(false);
+            Debug.Print("[Warning] {0} leaked, did you forget to call Dispose()?");
+            // We may not Dispose() the toolkit from the finalizer thread,
+            // as that will crash on many operating systems.
         }
+        #endif
 
         #endregion
     }