···156156 os_mutex_unlock(&sess->sys->sync_actions_mutex);
157157 }
158158159159- if (syncInfo->countActiveActionSets == 0) {
160160- // nothing to do
161161- return XR_SUCCESS;
162162- }
163163-164159 for (uint32_t i = 0; i < syncInfo->countActiveActionSets; i++) {
165160 struct oxr_action_set *act_set = NULL;
161161+166162 OXR_VERIFY_ACTIONSET_NOT_NULL(&log, syncInfo->activeActionSets[i].actionSet, act_set);
167163168164 XrResult res = oxr_verify_subaction_path_sync(&log, sess->sys->inst, act_set,
+26-1
src/xrt/state_trackers/oxr/oxr_input.c
···11// Copyright 2018-2024, Collabora, Ltd.
22-// Copyright 2023, NVIDIA CORPORATION.
22+// Copyright 2023-2025, NVIDIA CORPORATION.
33// SPDX-License-Identifier: BSL-1.0
44/*!
55 * @file
···18621862 struct oxr_action_set *act_set = NULL;
18631863 struct oxr_action_set_attachment *act_set_attached = NULL;
1864186418651865+ /*
18661866+ * No side-effects allowed in this section as we are still
18671867+ * validating and checking for errors at this point.
18681868+ */
18691869+18651870 // Check that all action sets has been attached.
18661871 for (uint32_t i = 0; i < countActionSets; i++) {
18671872 oxr_session_get_action_set_attachment(sess, actionSets[i].actionSet, &act_set_attached, &act_set);
···18711876 "not been attached to this session",
18721877 i, act_set != NULL ? act_set->data->name : "NULL");
18731878 }
18791879+ }
18801880+18811881+ /*
18821882+ * Can only call this function if the session state is focused. This is
18831883+ * not an error and has to be checked after all validation, but before
18841884+ * any side-effects happens.
18851885+ */
18861886+ if (sess->state != XR_SESSION_STATE_FOCUSED) {
18871887+ return XR_SESSION_NOT_FOCUSED;
18881888+ }
18891889+18901890+ /*
18911891+ * Side-effects allowed below, but not validation.
18921892+ */
18931893+18941894+ if (countActionSets == 0) {
18951895+ // Nothing to do.
18961896+ return XR_SUCCESS;
18741897 }
1875189818761899 // Synchronize outputs to this time.
···19221945 OXR_FOR_EACH_SUBACTION_PATH(ACCUMULATE_REQUESTED)
19231946#undef ACCUMULATE_REQUESTED
19241947 }
19481948+19491949+ //! @TODO This validation is not allowed here, must done above.
19251950 if (!any_action_with_subactionpath) {
19261951 return oxr_error(log, XR_ERROR_PATH_UNSUPPORTED,
19271952 "No action with specified subactionpath in actionset");