From 535832bb30462fe175bd44eac22a324f769d6751 Mon Sep 17 00:00:00 2001 From: Arnold Loubriat Date: Tue, 2 Jun 2026 22:47:52 +0200 Subject: [PATCH] fix: Compute index in parent for tree roots on Unix --- platforms/atspi-common/src/node.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/platforms/atspi-common/src/node.rs b/platforms/atspi-common/src/node.rs index 0e3832eb..f4361ee5 100644 --- a/platforms/atspi-common/src/node.rs +++ b/platforms/atspi-common/src/node.rs @@ -847,9 +847,17 @@ impl PlatformNode { } pub fn index_in_parent(&self) -> Result { - self.resolve(|node| { - i32::try_from(node.preceding_filtered_siblings(&filter).count()) - .map_err(|_| Error::IndexOutOfRange) + self.resolve_with_context(|node, _tree, context| { + if node.filtered_parent(&filter).is_some() { + i32::try_from(node.preceding_filtered_siblings(&filter).count()) + .map_err(|_| Error::IndexOutOfRange) + } else { + let index = context + .read_app_context() + .adapter_index(self.adapter_id) + .map_err(|_| Error::Defunct)?; + i32::try_from(index).map_err(|_| Error::IndexOutOfRange) + } }) }