From 47ff8dfff35cfe7306611f72bc62fe7a30e0d6f0 Mon Sep 17 00:00:00 2001 From: Shijian Date: Thu, 13 Jun 2024 16:08:13 +0800 Subject: [PATCH] Correctly destroy the muti-localspace Part-of: --- src/xrt/auxiliary/util/u_space_overseer.c | 4 ++-- src/xrt/ipc/server/ipc_server_handler.c | 5 +++-- src/xrt/ipc/server/ipc_server_per_client_thread.c | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/xrt/auxiliary/util/u_space_overseer.c b/src/xrt/auxiliary/util/u_space_overseer.c index 7efaba952..5edac6546 100644 --- a/src/xrt/auxiliary/util/u_space_overseer.c +++ b/src/xrt/auxiliary/util/u_space_overseer.c @@ -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); diff --git a/src/xrt/ipc/server/ipc_server_handler.c b/src/xrt/ipc/server/ipc_server_handler.c index 71b82434f..aaecca453 100644 --- a/src/xrt/ipc/server/ipc_server_handler.c +++ b/src/xrt/ipc/server/ipc_server_handler.c @@ -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; diff --git a/src/xrt/ipc/server/ipc_server_per_client_thread.c b/src/xrt/ipc/server/ipc_server_per_client_thread.c index 0222bcd67..9949195af 100644 --- a/src/xrt/ipc/server/ipc_server_per_client_thread.c +++ b/src/xrt/ipc/server/ipc_server_per_client_thread.c @@ -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.