Merge pull request #2905 from psychon/imagebox_raw_pointers

imagebox:set_widget(): Handle userdata again
This commit is contained in:
mergify[bot] 2019-10-11 16:50:57 +00:00 committed by GitHub
commit bafe028a05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -133,6 +133,13 @@ end
function imagebox:set_image(image) function imagebox:set_image(image)
local setup_succeed local setup_succeed
if type(image) == "userdata" then
-- This function is not documented to handle userdata objects, but
-- historically it did, and it did by just assuming they refer to a
-- cairo surface.
image = surface.load(image)
end
if type(image) == "string" then if type(image) == "string" then
-- try to load rsvg handle from file -- try to load rsvg handle from file
setup_succeed = load_and_apply(self, image, load_rsvg_handle, set_handle) setup_succeed = load_and_apply(self, image, load_rsvg_handle, set_handle)