Skip to content

WIP: Refactor CompositeNodeObserver

Marking as WIP because I found that prepending vs. appending does make a difference and causes a regression.

Some refactoring of Inkscape::XML::CompositeNodeObserver:

  • Increment marked_count in mark_one() function. This should fix a leak, previously marked items were never removed.
  • use std::forward_list instead of Inkscape::Util::ListContainer
  • remove _pending because items can be added to _active without invalidating iterators.

Inkscape::Util::ListContainer is almost identical to std::forward_list, and was only used in this one place.

Observers are now prepended instead of appended to the list (forward_list can only prepend), but I assume that there is no semantics in observer order and this should not matter.

Stumbled across this during a performance issue investigation, the refactoring was more or less a side product. Took me some time to understand that Inkscape::GC::Alloc has to be used, without it I got untraceable memory corruptions.

Edited by Thomas Holder

Merge request reports