Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dispose error on unitialized control #113

Open
MikaelStalvik opened this issue Aug 6, 2023 · 1 comment
Open

Dispose error on unitialized control #113

MikaelStalvik opened this issue Aug 6, 2023 · 1 comment
Labels
4.0 bug Something isn't working

Comments

@MikaelStalvik
Copy link

If the GLWpfControl cannot be initialized as described in this issue, an error will be thrown when the control is internally disposed:

OpenTK.Windowing.GraphicsLibraryFramework.GLFWException: You can only dispose windows on the main thread. The window needs to be disposed as it cannot safely be disposed in the finalizer. at OpenTK.Windowing.Desktop.NativeWindow.Dispose(System.Boolean disposing) at offset 54 at OpenTK.Windowing.Desktop.NativeWindow.Finalize()

This seems weird since the actual control is created, but not properly initialized, on the main thread.

@NogginBops NogginBops added bug Something isn't working 4.0 labels Aug 13, 2023
@NogginBops
Copy link
Member

Ok it seems like this is happening because after the exception is thrown in window creation the NativeWindow finalizer gets called and that isn't supposed to happen.
Not sure if this issue is best fixed in GLWpfControl or in OpenTK itself, will have to think about that one.
But basically we could catch the exception and dispose the window ourself in some way, but it might require changes in OpenTK to fully work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.0 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants