Copy token in nextStart function.

See
bc81053dbc (commitcomment-140301890)
and bc81053dbc (commitcomment-140303962)
This commit is contained in:
Martin Dosch 2024-03-27 21:12:42 +01:00
parent 0c7ee22452
commit bbd90cc04b

View File

@ -1466,11 +1466,12 @@ type rosterItem struct {
func (c *Client) nextStart() (xml.StartElement, error) { func (c *Client) nextStart() (xml.StartElement, error) {
for { for {
c.nextMutex.Lock() c.nextMutex.Lock()
t, err := c.p.Token() to, err := c.p.Token()
if err != nil || t == nil { if err != nil || to == nil {
c.nextMutex.Unlock() c.nextMutex.Unlock()
return xml.StartElement{}, err return xml.StartElement{}, err
} }
t := xml.CopyToken(to)
switch t := t.(type) { switch t := t.(type) {
case xml.StartElement: case xml.StartElement:
c.nextMutex.Unlock() c.nextMutex.Unlock()