forked from len0rd/rockbox
put_line(): Do not lock up if the scroll engine runs out of lines.
Allocate MAX_LINES+1 because at the time get_line_desc() is called the scroll engine did not yet determine that it ran out of lines (because puts_scroll_func() wasn't called yet. Therefore we can run out of lines before setting the used field. By allocating one item more we can survive that point and set used to false if the scroll engine runs out of lines. Change-Id: I7a9af1bce256c6e07d254f096bd5865fa7cf2cee
This commit is contained in:
parent
c0a02c98c1
commit
6e882b43b6
1 changed files with 10 additions and 2 deletions
|
@ -51,9 +51,17 @@ static void put_text(struct screen *display, int x, int y, struct line_desc *lin
|
||||||
const char *text, bool prevent_scroll, int text_skip_pixels);
|
const char *text, bool prevent_scroll, int text_skip_pixels);
|
||||||
|
|
||||||
struct line_desc_scroll {
|
struct line_desc_scroll {
|
||||||
struct line_desc desc; /* must be first! */
|
struct line_desc desc;
|
||||||
bool used;
|
bool used;
|
||||||
} lines[MAX_LINES];
|
};
|
||||||
|
|
||||||
|
/* Allocate MAX_LINES+1 because at the time get_line_desc() is called
|
||||||
|
* the scroll engine did not yet determine that it ran out of lines
|
||||||
|
* (because puts_scroll_func() wasn't called yet. Therefore we can
|
||||||
|
* run out of lines before setting the used field. By allocating
|
||||||
|
* one item more we can survive that point and set used to false
|
||||||
|
* if the scroll engine runs out of lines */
|
||||||
|
static struct line_desc_scroll lines[MAX_LINES+1];
|
||||||
|
|
||||||
static struct line_desc_scroll *get_line_desc(void)
|
static struct line_desc_scroll *get_line_desc(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue