mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	Correctly free primary selection manager & source
This commit is contained in:
		
							parent
							
								
									077bdfa789
								
							
						
					
					
						commit
						d4d860666c
					
				
					 1 changed files with 10 additions and 1 deletions
				
			
		| 
						 | 
					@ -141,10 +141,18 @@ static const struct gtk_primary_selection_source_interface source_impl = {
 | 
				
			||||||
	.destroy = source_handle_destroy,
 | 
						.destroy = source_handle_destroy,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void source_resource_handle_destroy( struct wl_resource *resource) {
 | 
					static void source_resource_handle_destroy(struct wl_resource *resource) {
 | 
				
			||||||
	struct wlr_primary_selection_source *source =
 | 
						struct wlr_primary_selection_source *source =
 | 
				
			||||||
		wl_resource_get_user_data(resource);
 | 
							wl_resource_get_user_data(resource);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_signal_emit(&source->events.destroy, source);
 | 
						wl_signal_emit(&source->events.destroy, source);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						char **p;
 | 
				
			||||||
 | 
						wl_array_for_each(p, &source->mime_types) {
 | 
				
			||||||
 | 
							free(*p);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						wl_array_release(&source->mime_types);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free(source);
 | 
						free(source);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -360,6 +368,7 @@ void wlr_primary_selection_device_manager_destroy(
 | 
				
			||||||
	if (manager == NULL) {
 | 
						if (manager == NULL) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						wl_list_remove(&manager->display_destroy.link);
 | 
				
			||||||
	// TODO: free wl_resources
 | 
						// TODO: free wl_resources
 | 
				
			||||||
	wl_global_destroy(manager->global);
 | 
						wl_global_destroy(manager->global);
 | 
				
			||||||
	free(manager);
 | 
						free(manager);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue