aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2017-10-26 17:44:57 -0700
committerJoe Wilm <joe@jwilm.com>2017-10-26 18:46:44 -0700
commit22ccd7b4b13b02fa56a75c4b737f941a99bb9782 (patch)
treef94a241e893c7d6017ad270e36c8ac5fae0bb05b
parent16c047b08ab1f844f9590efb0d5212d6e9924daf (diff)
downloadalacritty-22ccd7b4b13b02fa56a75c4b737f941a99bb9782.tar.gz
alacritty-22ccd7b4b13b02fa56a75c4b737f941a99bb9782.zip
Fix stack overflow
Resolves #872
-rw-r--r--src/renderer/mod.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs
index 9305e135..bb025875 100644
--- a/src/renderer/mod.rs
+++ b/src/renderer/mod.rs
@@ -900,10 +900,12 @@ impl<'a> LoadGlyph for RenderApi<'a> {
match self.atlas[*self.current_atlas].insert(rasterized, &mut self.active_tex) {
Ok(glyph) => glyph,
Err(_) => {
- let atlas = Atlas::new(ATLAS_SIZE);
- *self.active_tex = 0; // Atlas::new binds a texture. Ugh this is sloppy.
- *self.current_atlas = 0;
- self.atlas.push(atlas);
+ *self.current_atlas += 1;
+ if *self.current_atlas == self.atlas.len() {
+ let atlas = Atlas::new(ATLAS_SIZE);
+ *self.active_tex = 0; // Atlas::new binds a texture. Ugh this is sloppy.
+ self.atlas.push(atlas);
+ }
self.load_glyph(rasterized)
}
}