jlaurens / synctex

Synchronization for TeX
MIT License
64 stars 19 forks source link

scanner_free crashes with special file on windows #64

Open sunderme opened 1 year ago

sunderme commented 1 year ago

https://github.com/texstudio-org/texstudio/issues/3083

Crashes on windows, probably because stack size is smaller. From the looks of it, call depth is too large for recursive _synctex_free_leaf/synctex_node_free

sunderme commented 1 year ago

fixed by avoiding recursive function calls for node siblings.

static void _synctex_free_node(synctex_node_p node) {
    if (node) {
        SYNCTEX_SCANNER_REMOVE_HANDLE_TO(node);
        SYNCTEX_WILL_FREE(node);
        synctex_node_p n=node;
        synctex_node_p nextNode=n;
        do {
            nextNode=__synctex_tree_sibling(n);
            synctex_node_free(_synctex_tree_child(n));
            _synctex_free(n);
        } while(n=nextNode);
    }
    return;
}