>
>
> My *tentative* conclusion is that there may be a bug in 
> fc.retrieveVnodesFromDb. However, there are no special cases in this code, 
> so what the bug could possibly be is a big mystery. Iirc, Vitalije wrote 
> this code. Any insights would be appreciated.
>
>
I am almost 100% sure that the fc.retrieveVnodesFromDb works correctly. It 
just restores outline from the rows retrieved from db. Saving and loading 
from db work in tandem. If the outline being saved has broken links, then 
the outline loaded afterwards will have broken links too.

Most likely outline got broken links during some modification and later was 
saved as such.

Here is a script that can fix broken links:
from collections import defaultdict
def relink_outline(c):
    '''Normalizes outline fixing broken links'''
    parDict = defaultdict(list)
    for p in c.all_positions():
        parDict[p.gnx].append(p._parentVnode())
    gnx2v = c.fileCommands.gnxDict
    for gnx, parents in parDict.items():
        v = gnx2v[gnx]
        v.parents = parents
    c.checkOutline()
relink_outline(c)

When saving to xml information about parent links is omitted. When loading 
from xml file, correct parent links are infered again. Perhaps I can change 
writing to db to omitt parent links and just infer them when loading from 
db.

It is still a mistery how k-hen got his outline to this invalid state. My 
guess is that it was caused during the updating clones in both @file files 
and @nosent files. That would explain why we haven't noticed this bug 
before. It is not very common to have shared clones in both @nosent and 
@file files.

Vitalije

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/56aa7952-a09d-4da5-b176-206916448e26o%40googlegroups.com.

Reply via email to