Browse Source

codec: codecFner.reset should reset all typeInfos (in case *TypeInfos changes)

Fixes #256
Ugorji Nwoke 7 years ago
parent
commit
e789f6e370
1 changed files with 5 additions and 2 deletions
  1. 5 2
      codec/helper.go

+ 5 - 2
codec/helper.go

@@ -1656,9 +1656,12 @@ func (c *codecFner) reset(hh Handle) {
 		c.h, bh = bh, c.h // swap both
 		c.h, bh = bh, c.h // swap both
 		_, c.js = hh.(*JsonHandle)
 		_, c.js = hh.(*JsonHandle)
 		c.be = hh.isBinary()
 		c.be = hh.isBinary()
-		for i := range c.s {
-			c.s[i].fn.i.ready = false
+		if len(c.s) > 0 {
+			c.s = c.s[:0]
 		}
 		}
+		// for i := range c.s {
+		// 	c.s[i].fn.i.ready = false
+		// }
 	}
 	}
 }
 }