Skip to content

Commit 21fdc89

Browse files
authored
fix leak of temporary GL context on windows (#199)
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.
1 parent 267769b commit 21fdc89

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/gl/win.rs

+1
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ impl GlContext {
192192
};
193193

194194
wglMakeCurrent(hdc_tmp, std::ptr::null_mut());
195+
wglDeleteContext(hglrc_tmp);
195196
ReleaseDC(hwnd_tmp, hdc_tmp);
196197
UnregisterClassW(class as *const WCHAR, hinstance);
197198
DestroyWindow(hwnd_tmp);

0 commit comments

Comments
 (0)