@@ -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)
343346
344347function StructUtils. lift (style:: StructStyle , :: Type{T} , x:: LazyValues , tags= (;)) where {T}
345348 type = gettype (x)
349+ buf = getbuf (x)
346350 if type == JSONTypes. STRING
347- ptrstr, pos = parsestring (x)
348- str, _ = StructUtils. lift (style, T, ptrstr, tags)
351+ GC. @preserve buf begin
352+ ptrstr, pos = parsestring (x)
353+ str, _ = StructUtils. lift (style, T, ptrstr, tags)
354+ end
349355 return str, pos
350356 elseif type == JSONTypes. NUMBER
351357 num, pos = parsenumber (x)
448454 Base. @nexprs $ N i -> begin
449455 if typ == JSONTypes. OBJECT
450456 # consume key
451- _, pos = @inline parsestring (LazyValue (buf, pos, JSONTypes. STRING, opts, false ))
457+ GC. @preserve buf begin
458+ _, pos = @inline parsestring (LazyValue (buf, pos, JSONTypes. STRING, opts, false ))
459+ end
452460 @nextbyte
453461 if b != UInt8 (' :' )
454462 error = ExpectedColon
483491 while true
484492 if typ == JSONTypes. OBJECT
485493 # consume key
486- _, pos = @inline parsestring (LazyValue (buf, pos, JSONTypes. STRING, opts, false ))
494+ GC. @preserve buf begin
495+ _, pos = @inline parsestring (LazyValue (buf, pos, JSONTypes. STRING, opts, false ))
496+ end
487497 @nextbyte
488498 if b != UInt8 (' :' )
489499 error = ExpectedColon
0 commit comments