fix rust issue in y-crdt fork, fix destroy bug in YXmlAttr
3 files changed,  +18, -2
M .gitmodules
+1, -1
1@@ -1,3 +1,3 @@
2 [submodule "y-crdt"]
3 	path = y-crdt
4-	url = https://github.com/y-crdt/y-crdt
5+	url = https://github.com/BTBurke/y-crdt
M lib/linux-amd64/libyrs.a
+0, -0
M xml.go
+17, -1
 1@@ -317,6 +317,22 @@ func (it *XmlAttrIter) Destroy() {
 2 type XmlAttr struct {
 3 	Name  string
 4 	Value *Output
 5+	ptr   *C.YXmlAttr // underlying C struct - nil after Destroy()
 6+}
 7+
 8+// Destroy releases resources associated with this attribute.
 9+// This MUST be called when done with the attribute to prevent memory leaks.
10+func (a *XmlAttr) Destroy() {
11+	if a.ptr != nil {
12+		C.yxmlattr_destroy(a.ptr)
13+		a.ptr = nil
14+	}
15+	// Note: a.Value is freed by yxmlattr_destroy via YXmlAttr's Drop impl,
16+	// so we just nil the pointer here without calling Destroy()
17+	if a.Value != nil {
18+		a.Value.ptr = nil
19+		a.Value = nil
20+	}
21 }
22 
23 // Next returns the next attribute. Returns nil when iteration is complete.
24@@ -332,7 +348,7 @@ func (it *XmlAttrIter) Next() (*XmlAttr, error) {
25 	name := C.GoString(attr.name)
26 	value := &Output{ptr: attr.value}
27 
28-	return &XmlAttr{Name: name, Value: value}, nil
29+	return &XmlAttr{Name: name, Value: value, ptr: attr}, nil
30 }
31 
32 // AttrIter returns an iterator over the element's attributes.