Project

Profile

Help

Bug #6628

closed

copy constructor for Xdm objects failure

Added by O'Neil Delpratt 14 days ago. Updated 14 days ago.

Status:
Resolved
Priority:
High
Category:
C++ API
Start date:
2025-01-07
Due date:
% Done:

100%

Estimated time:
Applies to branch:
12, trunk
Fix Committed on Branch:
12, trunk
Fixed in Maintenance Release:
Found in version:
12.5
Fixed in version:
SaxonC Languages:
C++
SaxonC Platforms:
All
SaxonC Architecture:

Description

Reported by user here: https://saxonica.plan.io/boards/4/topics/9826?r=9838#message-9838

The following C++ code snippet which attempts to use the XdmNode copy constructor is failing:

...
root = new XdmNode(*child);
delete child;
XdmNode **children = root->getChildren();

The problem is the internal reference in the object handle pool for child node object is shared in the new copy (i.e. root), but this gets destroyed by the call delete child and therefore will be garbage collected at some point in the GC cycle.

The only real workaround is to avoid using the copy constructor.

Please register to edit this issue

Also available in: Atom PDF