Fix #1 with the solution by @pgimeno

This commit is contained in:
Robin Wellner 2018-11-30 13:17:27 +00:00 committed by GitHub
parent e817e4de28
commit 214ad35f62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -370,7 +370,10 @@ end, loadLoveFile = function(fname)
local serializedData, error = love.filesystem.newFileData(fname)
assert(serializedData, error)
Buffer_newDataReader(serializedData:getPointer(), serializedData:getSize())
return deserialize_value({})
local value = deserialize_value({})
-- serializedData needs to not be collected early in a tail-call
-- so make sure deserialize_value returns before loadLoveFile does
return value
end, loadData = function(data, size)
Buffer_newDataReader(data, size)
return deserialize_value({})