summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail "L117" Nikolenko <l117@l117.xyz>2021-02-20 05:00:10 +1000
committerGitHub <noreply@github.com>2021-02-19 19:00:10 +0000
commit4f22e6f518864c968bce919401adea90279f2d34 (patch)
tree43a3933260a2391e9f7755abd1a7f656841a3e95
parent3dafec076b7a69aaa80a66f9de9930da78d23c00 (diff)
downloadalacritty-4f22e6f518864c968bce919401adea90279f2d34.tar.gz
alacritty-4f22e6f518864c968bce919401adea90279f2d34.zip
Add Drop implementations for OpenGL structures
-rw-r--r--alacritty/src/renderer/mod.rs18
-rw-r--r--alacritty/src/renderer/rects.rs9
2 files changed, 27 insertions, 0 deletions
diff --git a/alacritty/src/renderer/mod.rs b/alacritty/src/renderer/mod.rs
index d4cee1a1..4d752463 100644
--- a/alacritty/src/renderer/mod.rs
+++ b/alacritty/src/renderer/mod.rs
@@ -754,6 +754,16 @@ impl QuadRenderer {
}
}
+impl Drop for QuadRenderer {
+ fn drop(&mut self) {
+ unsafe {
+ gl::DeleteBuffers(1, &self.vbo_instance);
+ gl::DeleteBuffers(1, &self.ebo);
+ gl::DeleteVertexArrays(1, &self.vao);
+ }
+ }
+}
+
impl<'a> RenderApi<'a> {
pub fn clear(&self, color: Rgb) {
unsafe {
@@ -1402,3 +1412,11 @@ impl Atlas {
Ok(())
}
}
+
+impl Drop for Atlas {
+ fn drop(&mut self) {
+ unsafe {
+ gl::DeleteTextures(1, &self.id);
+ }
+ }
+}
diff --git a/alacritty/src/renderer/rects.rs b/alacritty/src/renderer/rects.rs
index 80886c95..fd966d27 100644
--- a/alacritty/src/renderer/rects.rs
+++ b/alacritty/src/renderer/rects.rs
@@ -344,6 +344,15 @@ impl RectRenderer {
}
}
+impl Drop for RectRenderer {
+ fn drop(&mut self) {
+ unsafe {
+ gl::DeleteBuffers(1, &self.vbo);
+ gl::DeleteVertexArrays(1, &self.vao);
+ }
+ }
+}
+
/// Rectangle drawing program.
#[derive(Debug)]
pub struct RectShaderProgram {