[g-a-devel]Accessibles lifetime & events order
- From: gnome-accessibility-devel bernard-hugueney org
- To: gnome-accessibility-devel gnome org
- Subject: [g-a-devel]Accessibles lifetime & events order
- Date: Mon, 22 Sep 2003 11:40:57 +0200
Bonjour,
As I have already explained to this list, I am catching every possible
event, and then going up the accessible hierarchy from the event
source.
(code sample :
for( spi::accessible par(source); par ; par=par.parent())
{
// read info in par
}
)
I was having trouble with Accessibles from the GUI hierarchy
disappearing under my feat because of defunct events.
The solution I was using was to save the information about the
Accessibles that were being destroyed, and use it when I would
otherwise be using a pointer to a dead Accessible ( with a map from
pointer to information).
(new code
bool dying=e.type().find("defunct")!=Glib::ustring::npos;
...
if(dying){
// store time of death a ptr to info data structure
}
...
for( spi::accessible par(source); par ; par=par.parent())
{
if(is_ok(par.id()) || dying){
// read info on par
if(dying) {/*.. store info of dying accessible */}
}else if(is_dead(par.id())){
// get info stored in data structure
}
)
I was not happy with this because pointer (memory locations in fact)
get reused, so I had to decide when I would trust the pointer to be a
new Accessible and not dangling from the defunct one :
When I got a pointer to Accessible for which I had seen a defunct
event, I could not reliably decide wether it was still related to the
obsolete Accessible, of if the memory locaton was reused for a new
one.
Toying with my code, I just realised that the original problem
(Accessible disappearing when I wanted to use them) was gone !
Am I just lucky ?
I really would like to clean my code, I would not wat to rely on luck.
Does anybody have any insight to share ?
Thank you very much in advance !
Bernard,
PS: In fact the problem does not disappear entierly: I would like to
have unique ID for each Accessible. Pointer value would be an
obivious choise, but I (once again ) have to handle the reuse.
Unless someone can suggest anything better ?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]