diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2023-02-11 21:05:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-11 21:05:39 +0300 |
commit | 38e0b562a9e9c45518816cc98b951bdb5ddfd618 (patch) | |
tree | bc7867aba00f3b4efd9291e571749f866770d284 | |
parent | 2d27fff796791bf164af8605f97eda16fcb0f724 (diff) | |
download | alacritty-38e0b562a9e9c45518816cc98b951bdb5ddfd618.tar.gz alacritty-38e0b562a9e9c45518816cc98b951bdb5ddfd618.zip |
Fix crash when Atlas is full
This fixes the regression introduced by 2d27fff.
Fixes #6688.
-rw-r--r-- | alacritty/src/renderer/text/atlas.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/alacritty/src/renderer/text/atlas.rs b/alacritty/src/renderer/text/atlas.rs index 0d9b6cfd..9d4cb401 100644 --- a/alacritty/src/renderer/text/atlas.rs +++ b/alacritty/src/renderer/text/atlas.rs @@ -259,9 +259,13 @@ impl Atlas { match atlas[*current_atlas].insert(rasterized, active_tex) { Ok(glyph) => glyph, Err(AtlasInsertError::Full) => { + // Get the context type before adding a new Atlas. + let is_gles_context = atlas[*current_atlas].is_gles_context; + + // Advance the current Atlas index. *current_atlas += 1; if *current_atlas == atlas.len() { - let new = Atlas::new(ATLAS_SIZE, atlas[*current_atlas].is_gles_context); + let new = Atlas::new(ATLAS_SIZE, is_gles_context); *active_tex = 0; // Atlas::new binds a texture. Ugh this is sloppy. atlas.push(new); } |