[Libreoffice] XMutableTreeNode.removeChildByIndex () hangs up

LRN lrn1986 at gmail.com
Mon May 16 02:40:01 PDT 2011


I have a problem:
in python-uno XMutableTreeNode.removeChildByIndex() takes _seconds_ 
(sometimes minutes) to remove a node from a tree when the node is not 
the last in the list of its siblings.
LO hangs for some random amount of time, fully consuming one CPU core 
(good thing i have 8 virtual ones...). From the looks of the stack of 
its only working thread, he spends all its time somewhere in python26.dll
I've had a theory that this is somehow related to garbage collecting and 
memory references, but was unable to fix this by setting DisplayValue 
and DataValue to new objects (strings) that are not referenced by 
anything else.
Recursively removing all children of the item (it has some) doesn't hang 
anything, only removing the root of the branch does.
The tree looks like this:
Root
   A
     1
   B
     2
   C
     3
   D
     1
       I
         foo
       II
         bar
     2
       III
         foo
       IV
         bar
     3
     ...
     6
   E
Subitems are removed from the (D) node
Removing (6), then (5), then (4), etc works, while removing anything 
other than (6) first doesn't.
Recursive children pre-removal means that by the time i call 
(figuratively speaking) (D).removeChildByIndex (1) to remove (1), (1) 
does not have any children anymore.
I think i can work around this by clearing the branch root of children, 
then copying all children of its bottom siblings up, filling the gaps, 
then removing the last sibling, which will be empty. But that will 
certainly take a bit more time and might actually be seen by the user 
(especially onn slow PCs).



More information about the LibreOffice mailing list