mirror of
https://github.com/wez/wezterm.git
synced 2024-11-13 07:22:52 +03:00
egl: add explicit drop impl for GlState
This tidies up the valgrind output some more, but seems to highlight some leaks in the egl implementation around init/shutdown. I still don't see a smoking gun for a memory leak that grows over time. refs: https://github.com/wez/wezterm/issues/238
This commit is contained in:
parent
888cded0e3
commit
dddf67e07a
@ -50,6 +50,22 @@ pub struct GlState {
|
||||
context: ffi::types::EGLContext,
|
||||
}
|
||||
|
||||
impl Drop for GlState {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
self.egl.egl.MakeCurrent(
|
||||
self.display,
|
||||
ffi::NO_SURFACE,
|
||||
ffi::NO_SURFACE,
|
||||
ffi::NO_CONTEXT,
|
||||
);
|
||||
self.egl.egl.DestroySurface(self.display, self.surface);
|
||||
self.egl.egl.DestroyContext(self.display, self.context);
|
||||
self.egl.egl.Terminate(self.display);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type GetProcAddressFunc =
|
||||
unsafe extern "C" fn(*const std::os::raw::c_char) -> *const std::os::raw::c_void;
|
||||
|
||||
@ -67,7 +83,7 @@ impl EglWrapper {
|
||||
Ok(Self { _lib: lib, egl })
|
||||
}
|
||||
|
||||
pub fn get_display(
|
||||
fn get_display(
|
||||
&self,
|
||||
display: Option<ffi::EGLNativeDisplayType>,
|
||||
) -> anyhow::Result<ffi::types::EGLDisplay> {
|
||||
|
Loading…
Reference in New Issue
Block a user