aboutsummaryrefslogtreecommitdiff
path: root/src/renderer/mod.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2017-12-19 23:53:32 +0100
committerJoe Wilm <jwilm@users.noreply.github.com>2017-12-22 13:18:08 -0800
commit32cc53a901b24a683787d3417fd635fa06a278b6 (patch)
tree8e6980c813c5bad71dedb2f3f116822f0f1a8f91 /src/renderer/mod.rs
parent7f944a4d3acc40433e0608ad3c9c2dff5bd6295d (diff)
downloadalacritty-32cc53a901b24a683787d3417fd635fa06a278b6.tar.gz
alacritty-32cc53a901b24a683787d3417fd635fa06a278b6.zip
Fix stack-overflow when creating a new atlas
When an atlas is full and the `insert` call fails, a new atlas should be created. This is the current strategy, however the atlas is put at the end of the vector, but the `current_atlas` index is set to 0, instead of the last element. This leads to a recursion where it keeps trying to insert into the full atlas at position 0 instead of the new at `atlas.len() - 1`. With this simple fix a stack-overflow is prevented because the new atlas is inserted as the first element, which then will be used correctly for loading new glyphs. This fixes jwilm/alacritty/issues/842 and might also solve jwilm/alacritty/issues/914 (I wasn't able to reproduce this with the latest master).
Diffstat (limited to 'src/renderer/mod.rs')
-rw-r--r--src/renderer/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs
index 237c8416..e6d33c9b 100644
--- a/src/renderer/mod.rs
+++ b/src/renderer/mod.rs
@@ -876,7 +876,7 @@ impl<'a> LoadGlyph for LoaderApi<'a> {
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.atlas.insert(0, atlas);
self.load_glyph(rasterized)
}
}