mirror of
				https://gitlab.freedesktop.org/wayland/wayland.git
				synced 2025-11-03 09:01:42 -05:00 
			
		
		
		
	wayland-server: Improve error messages for bad globals
A bug in Weston's toytoolkit gave me an hour of debugging headaches. Improve the error messages that we send if a client requests an invalid global, either by name or by version.
This commit is contained in:
		
							parent
							
								
									148478323f
								
							
						
					
					
						commit
						40d057f2c9
					
				
					 1 changed files with 7 additions and 3 deletions
				
			
		| 
						 | 
					@ -701,11 +701,15 @@ registry_bind(struct wl_client *client,
 | 
				
			||||||
		if (global->name == name)
 | 
							if (global->name == name)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (&global->link == &display->global_list ||
 | 
						if (&global->link == &display->global_list)
 | 
				
			||||||
	    global->version < version)
 | 
					 | 
				
			||||||
		wl_resource_post_error(resource,
 | 
							wl_resource_post_error(resource,
 | 
				
			||||||
				       WL_DISPLAY_ERROR_INVALID_OBJECT,
 | 
									       WL_DISPLAY_ERROR_INVALID_OBJECT,
 | 
				
			||||||
				       "invalid global %d", name);
 | 
									       "invalid global %s (%d)", interface, name);
 | 
				
			||||||
 | 
						else if (global->version < version)
 | 
				
			||||||
 | 
							wl_resource_post_error(resource,
 | 
				
			||||||
 | 
									       WL_DISPLAY_ERROR_INVALID_OBJECT,
 | 
				
			||||||
 | 
									       "invalid version for global %s (%d): have %d, wanted %d",
 | 
				
			||||||
 | 
									       interface, name, global->version, version);
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		global->bind(client, global->data, version, id);
 | 
							global->bind(client, global->data, version, id);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue