[pyatspi2] Set removed child's parent to null, and use remove rather than del



commit 7f2f9274a686ce8d5912c75a22016911e2f98f80
Author: Mike Gorse <mgorse novell com>
Date:   Sat May 29 19:52:24 2010 -0400

    Set removed child's parent to null, and use remove rather than del
    
    If a ChildrenChanged::Remove signal is received and the removed child's
    parent is the sender, set the child's parent to null.
    Also, use remove() rather than del() to remove the child; should be
    more robust in case an app fails to send a ChildrenChanged event.

 pyatspi/cache.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/pyatspi/cache.py b/pyatspi/cache.py
index bc53986..12662a3 100644
--- a/pyatspi/cache.py
+++ b/pyatspi/cache.py
@@ -262,7 +262,11 @@ class ApplicationCacheManager (object):
                                 if minor == "add":
                                         item.children.insert (detail1, any_data)
                                 elif minor == "remove":
-                                        del (item.children[detail1])
+                                        item.children.remove (any_data)
+                                        if any_data in self._cache:
+                                                child = self._cache[any_data]
+                                                if child.parent == (sender, path):
+                                                        child.parent = (sender, ATSPI_NULL_PATH)
 
         def _state_changed_handler (self,
                                        minor, detail1, detail2, any_data, app,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]