Repository navigation
fix: keep the status bar text alive until the frame is rendered - #125
Open
gustawdaniel wants to merge 1 commit into
Open
gustawdaniel wants to merge 1 commit into
gustawdaniel wants to merge 1 commit into
Conversation
drawStatusBar formats its items into the arena and prints them, so the screen cells point into the arena, but it reset the arena on return, before vx.render compares the cells. When the arena had grown past one buffer, the reset freed the memory the cells pointed to, and Vaxis.render crashed in InternalCell.eql (segfault in debug builds, where freed pages are unmapped). The run loop already resets the arena after rendering.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
drawStatusBarformats its items intoself.arenaand prints them, so the status bar cells hold slices into the arena. It then reset the arena on return (defer _ = self.arena.reset(.retain_capacity), from #102), beforevx.rendercompares those cells with the previous frame.When the arena has grown past one buffer,
reset(.retain_capacity)frees the other buffers and may move the remaining one to its new size, so the cells point to freed memory. In a debug build that is a segfault inVaxis.render→InternalCell.eql→mem.eql; in a release build, garbage or a crash. I hit it repeatedly while scrolling quickly with a trackpad, which runs many frames in a row.The run loop already resets the arena after
vx.render, so the reset indrawStatusBarcan simply go. The text then lives exactly until the frame has been rendered.