Igalia / acacia

Library for inspecting accessibility APIs
https://igalia.github.io/acacia
GNU Lesser General Public License v2.1
8 stars 1 forks source link

Atspi: do we need to keep track of "when a AtspiAccessible has been killed by the application" #222

Open spectranaut opened 4 months ago

spectranaut commented 4 months ago

For example, Orca does it here: https://github.com/GNOME/orca/blob/34ba2393fc64c0e82f47da3900c7de398a89c2cb/src/orca/ax_object.py#L162

For use, we need to know when an object has been killed as well. Should we check preemptively, in IsNull? otherwise, will we throw a specific error every time? Seems a little annoying, because you will have to try/catch for whether the object still exists every time you use it.

spectranaut commented 4 months ago

Notes:

spectranaut commented 4 months ago

Probably this won't happen frequently in testing, but it's still worth thinking about a little bit more.

alice commented 4 months ago

I think maybe we can do something like https://github.com/Igalia/acacia/pull/226 here too - i.e. have the toString() method never throw/crash.

I like the idea of folding checking for dead-ness into isNull() - maybe then if it is dead, you could set the internal pointer to null as well, so future calls to isNull() will just return true without needing to check for deadness.

I guess we already somewhat handle dead-ness given that we throw a runtime error if we get an error back from one of the library functions, so maybe we just need to do what Orca does and inspect the error string to see whether it's because of a dead object, and null out the pointer if so?