mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05: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
							
								
									714511736b
								
							
						
					
					
						commit
						7dd7b5cc59
					
				
					 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