@@ -277,8 +277,11 @@ function applyvalue(f, x::LazyValues, null)
277277 f (arr)
278278 return pos
279279 elseif type == JSONTypes. STRING
280- str, pos = parsestring (x)
281- f (convert (String, str))
280+ buf = getbuf (x)
281+ GC. @preserve buf begin
282+ str, pos = parsestring (x)
283+ f (convert (String, str))
284+ end
282285 return pos
283286 elseif type == JSONTypes. NUMBER
284287 num, pos = parsenumber (x)
344347function StructUtils. lift (style:: StructStyle , :: Type{T} , x:: LazyValues , tags= (;)) where {T}
345348 type = gettype (x)
346349 if type == JSONTypes. STRING
347- ptrstr, pos = parsestring (x)
348- str, _ = StructUtils. lift (style, T, ptrstr, tags)
350+ GC. @preserve buf begin
351+ ptrstr, pos = parsestring (x)
352+ str, _ = StructUtils. lift (style, T, ptrstr, tags)
353+ end
349354 return str, pos
350355 elseif type == JSONTypes. NUMBER
351356 num, pos = parsenumber (x)
448453 Base. @nexprs $ N i -> begin
449454 if typ == JSONTypes. OBJECT
450455 # consume key
451- _, pos = @inline parsestring (LazyValue (buf, pos, JSONTypes. STRING, opts, false ))
456+ GC. @preserve buf begin
457+ _, pos = @inline parsestring (LazyValue (buf, pos, JSONTypes. STRING, opts, false ))
458+ end
452459 @nextbyte
453460 if b != UInt8 (' :' )
454461 error = ExpectedColon
483490 while true
484491 if typ == JSONTypes. OBJECT
485492 # consume key
486- _, pos = @inline parsestring (LazyValue (buf, pos, JSONTypes. STRING, opts, false ))
493+ GC. @preserve buf begin
494+ _, pos = @inline parsestring (LazyValue (buf, pos, JSONTypes. STRING, opts, false ))
495+ end
487496 @nextbyte
488497 if b != UInt8 (' :' )
489498 error = ExpectedColon
0 commit comments