Hello,
Calling "RemoveStructureChangedEventHandler" leads to a long period of waiting for it to be finished.
The interesting moment is that that I do not have any problems with either "RemoveFocusChangedEventHandler" or "RemovePropertyChangedEventHandler".
But I still face with that by calling "RemoveAllEventHandlers" :( (it is quite reasonable though).
Sometimes it's even about not finishing at all (it resembles a deadlock).
In my considered opinion, the more the handler is being used (the more events are processed i.e.) the more time the "RemoveStructureChangedEventHandler" method is being executed. Could this be so?
In addition to:
1) There are no any other threads which could add or remove event handlers as well;
2) If we have a look at the handler signature:
HRESULT HandleStructureChangedEvent(
IUIAutomationElement *sender,
StructureChangeType changeType,
SAFEARRAY *runtimeId
);
we will see that there are two parameters (sender and runtime) which we have to deallocate by ourselves (UIAutomation isn't in charge of doing that), won't we?
I understand that not every detail of the program is covered. But I tried to do my best speaking of the most important once. So please, let me know if you need any other details.
Thanks in advance!
UIAutomation. "RemoveStructureChangedEventHandler" takes much time
Calling "RemoveStructureChangedEventHandler" leads to a long period of waiting for it to be finished.
The interesting moment is that that I do not have any problems with either "RemoveFocusChangedEventHandler" or "RemovePropertyChangedEventHandler".
But I still face with that by calling "RemoveAllEventHandlers" :( (it is quite reasonable though).
Sometimes it's even about not finishing at all (it resembles a deadlock).
In my considered opinion, the more the handler is being used (the more events are processed i.e.) the more time the "RemoveStructureChangedEventHandler" method is being executed. Could this be so?
In addition to:
1) There are no any other threads which could add or remove event handlers as well;
2) If we have a look at the handler signature:
HRESULT HandleStructureChangedEvent(
IUIAutomationElement *sender,
StructureChangeType changeType,
SAFEARRAY *runtimeId
);
we will see that there are two parameters (sender and runtime) which we have to deallocate by ourselves (UIAutomation isn't in charge of doing that), won't we?
I understand that not every detail of the program is covered. But I tried to do my best speaking of the most important once. So please, let me know if you need any other details.
Thanks in advance!
UIAutomation. "RemoveStructureChangedEventHandler" takes much time