mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	test: fix dll unload
Call spa_handle_clear() on the handle before freeing. Actually store the loaded dll in the right array. First clear the handle, then close the dll. Fix iteration of the dlls.
This commit is contained in:
		
							parent
							
								
									c346ee5e90
								
							
						
					
					
						commit
						d28af43689
					
				
					 1 changed files with 7 additions and 4 deletions
				
			
		| 
						 | 
					@ -305,12 +305,14 @@ pwtest_spa_plugin_destroy(struct pwtest_spa_plugin *plugin)
 | 
				
			||||||
	struct spa_handle **hnd;
 | 
						struct spa_handle **hnd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SPA_FOR_EACH_ELEMENT(plugin->handles, hnd) {
 | 
						SPA_FOR_EACH_ELEMENT(plugin->handles, hnd) {
 | 
				
			||||||
		if (*hnd)
 | 
							if (*hnd) {
 | 
				
			||||||
 | 
								spa_handle_clear(*hnd);
 | 
				
			||||||
			free(*hnd);
 | 
								free(*hnd);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	SPA_FOR_EACH_ELEMENT(plugin->dlls, dll) {
 | 
						SPA_FOR_EACH_ELEMENT(plugin->dlls, dll) {
 | 
				
			||||||
		if (*dll)
 | 
							if (*dll)
 | 
				
			||||||
			dlclose(dll);
 | 
								dlclose(*dll);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	free(plugin);
 | 
						free(plugin);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -362,12 +364,13 @@ pwtest_spa_plugin_try_load_interface(struct pwtest_spa_plugin *plugin,
 | 
				
			||||||
	r = spa_handle_factory_init(factory, handle, info, plugin->support, plugin->nsupport);
 | 
						r = spa_handle_factory_init(factory, handle, info, plugin->support, plugin->nsupport);
 | 
				
			||||||
	pwtest_neg_errno_ok(r);
 | 
						pwtest_neg_errno_ok(r);
 | 
				
			||||||
	if ((r = spa_handle_get_interface(handle, interface_name, &iface)) != 0) {
 | 
						if ((r = spa_handle_get_interface(handle, interface_name, &iface)) != 0) {
 | 
				
			||||||
		dlclose(hnd);
 | 
							spa_handle_clear(handle);
 | 
				
			||||||
		free(handle);
 | 
							free(handle);
 | 
				
			||||||
 | 
							dlclose(hnd);
 | 
				
			||||||
		return -ENOSYS;
 | 
							return -ENOSYS;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	plugin->handles[plugin->ndlls++] = hnd;
 | 
						plugin->dlls[plugin->ndlls++] = hnd;
 | 
				
			||||||
	plugin->handles[plugin->nhandles++] = handle;
 | 
						plugin->handles[plugin->nhandles++] = handle;
 | 
				
			||||||
	plugin->support[plugin->nsupport++] = SPA_SUPPORT_INIT(interface_name, iface);
 | 
						plugin->support[plugin->nsupport++] = SPA_SUPPORT_INIT(interface_name, iface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue