The specification for XDG menu files allows having more than one group and
assumes no constraint on their order. The original code assumed that once
the proper group marker was found, everything after was part of it, causing
misinterpretation of some data, like taking the wrong launch command.

This patch stops the parsing of the menu XDG file when a new group is
found, hence implementing the expected behaviour.

Reported-by: Andreas Metzler <ametz...@bebt.de>
---
 util/wmmenugen_parse_xdg.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/util/wmmenugen_parse_xdg.c b/util/wmmenugen_parse_xdg.c
index fc5f6b19..31ee8130 100644
--- a/util/wmmenugen_parse_xdg.c
+++ b/util/wmmenugen_parse_xdg.c
@@ -132,6 +132,11 @@ void parse_xdg(const char *file, cb_add_menu_entry 
*addWMMenuEntryCallback)
                        /* start processing group */
                        memset(buf, 0, sizeof(buf));
                        continue;
+               } else if (p[0] == '[') {
+                       /* If we find a new group and the previous group was 
the main one,
+                        * we stop all further processing
+                        */
+                       if (InGroup) break;
                }
 
                if (!InGroup) {
-- 
2.11.0


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to