GLWpfControl icon indicating copy to clipboard operation
GLWpfControl copied to clipboard

Fix DXGLContext dispose

Open Krugpelke opened this issue 1 year ago • 0 comments

This fixes a couple of things related to DXGLContext dispose:

  • A call to DXCloseDeviceNV with an empty GLDeviceHandle crashes with AccessViolationException. This checks if GLDeviceHandle isn't empty beforehand.
  • Removed finalizer dispose as it might run from any thread and GlwfWindow can only be disposed on main thread.
  • Added a call to dispose before throwing an exception in ctor to ensure proper clean-up.

In my case I can now properly handle when the control can't initialize on integrated gpus without crashing. Maybe fixes 113 and 132 as they're similar to what I've encountered (though these may not be related as I now see that NativeWindow also has a finalizer).

Krugpelke avatar Aug 09 '24 09:08 Krugpelke