From f36642ab69a32fa05f703a006c2e30cdf515ac55 Mon Sep 17 00:00:00 2001 From: mmdolze Date: Wed, 10 Oct 2012 16:29:39 +0000 Subject: [PATCH] Fix a segmentation fault occuring when using menu_add_item without a text label. While there sync code and documentation about the possibility to use a label and options. --- ChangeLog | 1 + docs/lcdproc-dev/language.docbook | 15 ++++++++++++--- server/commands/menu_commands.c | 13 ++++++++----- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3763eda..945d57f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,6 +31,7 @@ v0.5dev (ongoing development) * hd44780/serial: Add support for adjustable backlight * Build system: Fix build with automake >= 1.11.3 (#3494755) * Fix clang compiler warnings about obsolete GNU designated initializers + * Fix crash when adding a menu item without text and options (S. Dawson) v0.5.5 + sed1330 driver: Add support for HG25504 (L. Lagendijk) diff --git a/docs/lcdproc-dev/language.docbook b/docs/lcdproc-dev/language.docbook index bb0f8cb..282b243 100644 --- a/docs/lcdproc-dev/language.docbook +++ b/docs/lcdproc-dev/language.docbook @@ -707,6 +707,7 @@ menu_set_item "test" test_ip -next "test_menu" -prev "test_alpha" menu_set_item "test" test_menu_action -next "_close_" + # replace the main menu with the client's menu as created above menu_set_main "" @@ -757,7 +758,8 @@ - + + @@ -765,8 +767,10 @@ Adds a new menu item to a menu. The main menu of a client, will be created automatically as soon as the client adds an item. This main menu has an empty id ("") and the name - is identical to the name of the client. The options are - described under menu_set_item below. + is identical to the name of the client. The item specific options + are described under menu_set_item below. Use of text + is optional and is a shortcut for "-text text" + option. @@ -777,6 +781,11 @@ menu_ids are unique (at least within a clients menu hierarchy). + + If you want to use a text label that starts with a '-' (minus) + character, you have to use the "-text text" + option. + menu item types diff --git a/server/commands/menu_commands.c b/server/commands/menu_commands.c index 3e8e4bc..38f557c 100644 --- a/server/commands/menu_commands.c +++ b/server/commands/menu_commands.c @@ -67,13 +67,14 @@ static char *argv2string(int argc, char **argv) * Adds an item to a menu. * *\verbatim - * Usage: menu_add_item [] + * Usage: menu_add_item [] {