mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
menu: fix crash triggered by pipemenu without parent <menu>
...such as the one in the example below:
<?xml version="1.0" encoding="UTF-8"?>
<openbox_menu>
<menu id="root-menu" label="obmenu-generator" execute="obmenu-generator"/>
</openbox_menu>
We should consider supporting this construct in future.
Reported-by: cry0xen via IRC
This commit is contained in:
parent
5a6a72da36
commit
7756d5b975
1 changed files with 17 additions and 0 deletions
|
|
@ -506,6 +506,23 @@ handle_menu_element(xmlNode *n, struct server *server)
|
|||
|
||||
if (execute && label && id) {
|
||||
wlr_log(WLR_DEBUG, "pipemenu '%s:%s:%s'", id, label, execute);
|
||||
if (!current_menu) {
|
||||
/*
|
||||
* We currently do not support pipemenus without a
|
||||
* parent <item> such as the one the example below:
|
||||
*
|
||||
* <?xml version="1.0" encoding="UTF-8"?>
|
||||
* <openbox_menu>
|
||||
* <menu id="root-menu" label="foo" execute="bar"/>
|
||||
* </openbox_menu>
|
||||
*
|
||||
* TODO: Consider supporting this
|
||||
*/
|
||||
wlr_log(WLR_ERROR,
|
||||
"pipemenu '%s:%s:%s' has no parent <menu>",
|
||||
id, label, execute);
|
||||
goto error;
|
||||
}
|
||||
current_item = item_create(current_menu, label, /* arrow */ true);
|
||||
current_item_action = NULL;
|
||||
current_item->execute = xstrdup(execute);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue