From 5f4889475c23446291deed87e59609a2fa4edd5f Mon Sep 17 00:00:00 2001 From: Marc Andre Tanner Date: Sat, 19 Mar 2011 16:58:52 +0100 Subject: [PATCH] Fix activation of selected entry Use a heap allocated variable for the menu entry instead of an automatic one which was no longer available when it was later accessed. Thanks to Guilhem Bonnefille for the report and an initial patch. Signed-off-by: Marc Andre Tanner --- qi-bootmenu.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/qi-bootmenu.c b/qi-bootmenu.c index 6bffc2a..1560337 100644 --- a/qi-bootmenu.c +++ b/qi-bootmenu.c @@ -167,13 +167,14 @@ int main(int argc, char **argv) { break; } } - MenuItem item = { - .text = s->dev, - .logo = s->logo, - .callback = gui_bootitem_clicked, - .data = s, - }; - gui->add(&item); + MenuItem *item = malloc(sizeof(MenuItem)); + if (!item) + continue; + item->text = s->dev; + item->logo = s->logo; + item->callback = gui_bootitem_clicked; + item->data = s; + gui->add(item); } /* add pre defined menu entries */ -- 2.11.4.GIT