Skip to content

Commit

Permalink
fix leak of temporary GL context on windows (#199)
Browse files Browse the repository at this point in the history
Creating a modern OpenGL context on Windows requires first creating a temporary context, using it to load some function pointers (e.g. `wglCreateContextAttribsARB`), and then using those to create the actual context. In Baseview's case, the temporary context was not being deleted afterwards, resulting in a resource leak.
  • Loading branch information
glowcoil authored Dec 5, 2024
1 parent 267769b commit 21fdc89
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/gl/win.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ impl GlContext {
};

wglMakeCurrent(hdc_tmp, std::ptr::null_mut());
wglDeleteContext(hglrc_tmp);
ReleaseDC(hwnd_tmp, hdc_tmp);
UnregisterClassW(class as *const WCHAR, hinstance);
DestroyWindow(hwnd_tmp);
Expand Down

0 comments on commit 21fdc89

Please sign in to comment.