Correctly destroy the muti-localspace

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2249>
This commit is contained in:
Shijian 2024-06-13 16:08:13 +08:00
parent f935fa943f
commit 47ff8dfff3
3 changed files with 7 additions and 6 deletions

View file

@ -836,8 +836,8 @@ destroy(struct xrt_space_overseer *xso)
u_hashmap_int_destroy(&uso->xdev_map);
for (int id = 0; id < XRT_MAX_CLIENT_SPACES; id++) {
struct xrt_space *xslocal = xso->localspace[id];
xrt_space_reference(&xslocal, NULL);
struct xrt_space **xslocal_ptr = (struct xrt_space **)&xso->localspace[id];
xrt_space_reference(xslocal_ptr, NULL);
}
pthread_rwlock_destroy(&uso->lock);

View file

@ -703,8 +703,9 @@ ipc_handle_space_destroy(volatile struct ipc_client_state *ics, uint32_t space_i
xrt_space_reference(xs_ptr, NULL);
if (space_id == ics->local_space_index) {
struct xrt_space *xslocal_ptr = ics->server->xso->localspace[ics->local_space_overseer_index];
xrt_space_reference(&xslocal_ptr, NULL);
struct xrt_space **xslocal_ptr =
(struct xrt_space **)&ics->server->xso->localspace[ics->local_space_overseer_index];
xrt_space_reference(xslocal_ptr, NULL);
}
return XRT_SUCCESS;

View file

@ -68,8 +68,8 @@ common_shutdown(volatile struct ipc_client_state *ics)
}
if (ics->local_space_overseer_index < IPC_MAX_CLIENT_SPACES && ics->local_space_overseer_index >= 0) {
struct xrt_space *xslocal = ics->server->xso->localspace[ics->local_space_overseer_index];
xrt_space_reference(&xslocal, NULL);
xrt_space_reference((struct xrt_space **)&ics->server->xso->localspace[ics->local_space_overseer_index],
NULL);
}
// Mark an still in use reference spaces as no longer used.