1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-22 05:48:01 +01:00

util: fix parsing of XDG menus with multiple groups

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 <ametzler@bebt.de>
This commit is contained in:
Christophe CURIS
2017-07-02 23:01:49 +02:00
committed by Carlos R. Mafra
parent 83f0b764e6
commit e037ae3684

View File

@@ -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) {