Skip to content

Conversation

chrisduerr
Copy link
Member

@chrisduerr chrisduerr commented Dec 19, 2017

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 /issues/842 and might also solve
/issues/914 (I wasn't able to reproduce this with the
latest master). Also fixes #898.

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 alacritty/issues/842 and might also solve
alacritty/issues/914 (I wasn't able to reproduce this with the
latest master).
chrisduerr and others added 2 commits December 20, 2017 01:33
Previously there were two separate but intended-to-be-identical
implementations. Now the two implementations simply delegate to a
single, shared method. This should help correctness issues in the
future.
@maximbaz
Copy link
Contributor

I confirm that it fixes the issue 👍
You are making very impressive PRs these days @chrisduerr, huge thanks for that!

P.S. I played with holding Ctrl +/- and found a silly issue, posting just in case you can immediately think of a simple fix, otherwise I guess it's not worth looking into:

  • Hold Ctrl +. The value reaches its maximum value (274 in my case) and stays there, pressing Ctrl + further has no effect. Pressing Ctrl - once reduces font size to 272.
  • Now hold Ctrl -. The value reaches its minimum value (2 in my case), but further presses of Ctrl - change the value to 2, again and again. If I press Ctrl - 10 times after I already reached the minimal value of 2, then pressing Ctrl + once will have no effect - the font size will stay at 2. I have to press Ctrl + 10 times to compensate for my earlier actions, before further presses of Ctrl + begin to actually increase the font.

@jwilm
Copy link
Contributor

jwilm commented Dec 22, 2017

@maximbaz would you mind filing another issue for that? We can fix this with a change in our book keeping.

@jwilm jwilm merged commit 41296a5 into alacritty:master Dec 22, 2017
@chrisduerr chrisduerr deleted the atlas-stack-overflow branch December 23, 2017 12:56
@chrisduerr chrisduerr restored the atlas-stack-overflow branch December 29, 2017 17:40
@chrisduerr chrisduerr deleted the atlas-stack-overflow branch January 3, 2018 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

X11 crashes while holding C-+ to increase font size Stack overflow when increasing font size to its maximum
3 participants