Skip to content

Commit

Permalink
fix an issue with GI methods that return string lists with "transfer-…
Browse files Browse the repository at this point in the history
…container"
  • Loading branch information
jwahlstrand committed Dec 3, 2023
1 parent d9003dc commit bb1088d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion GI/src/giimport.jl
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ function convert_from_c(name::Symbol, arginfo::ArgInfo, typeinfo::TypeDesc{T}) w
if elmtype.gitype == GObject
return :(arrtemp=collect(unsafe_wrap(Vector{$elmctype}, $name,$lensymb[]));GLib.g_free($name);arrtemp=convert.($(elmtype.jtype), arrtemp, false))
elseif elmctype == :(Ptr{UInt8}) || elmctype == :(Cstring)
return :(bytestring.(unsafe_wrap(Vector{$elmctype}, $name, $lensymb[]),true))
return :(arrtemp=bytestring.(unsafe_wrap(Vector{$elmctype}, $name, $lensymb[]),false);GLib.g_free($name);arrtemp)
else
return :(arrtemp=collect(unsafe_wrap(Vector{$elmctype}, $name,$lensymb[]));GLib.g_free($name);arrtemp)
end
Expand Down
18 changes: 15 additions & 3 deletions src/gen/glib_methods
Original file line number Diff line number Diff line change
Expand Up @@ -1973,7 +1973,11 @@ $(Expr(:toplevel, quote
function get_bytestring_array(instance::GVariant)
m_length = Ref{UInt64}()
ret = ccall(("g_variant_get_bytestring_array", libglib), Ptr{Cstring}, (Ptr{GVariant}, Ptr{UInt64}), instance, m_length)
ret2 = bytestring.(unsafe_wrap(Vector{Cstring}, ret, m_length[]), true)
ret2 = begin
arrtemp = bytestring.(unsafe_wrap(Vector{Cstring}, ret, m_length[]), false)
GLib.g_free(ret)
arrtemp
end
_length = m_length[]
ret2
end
Expand Down Expand Up @@ -2025,7 +2029,11 @@ $(Expr(:toplevel, quote
function get_objv(instance::GVariant)
m_length = Ref{UInt64}()
ret = ccall(("g_variant_get_objv", libglib), Ptr{Cstring}, (Ptr{GVariant}, Ptr{UInt64}), instance, m_length)
ret2 = bytestring.(unsafe_wrap(Vector{Cstring}, ret, m_length[]), true)
ret2 = begin
arrtemp = bytestring.(unsafe_wrap(Vector{Cstring}, ret, m_length[]), false)
GLib.g_free(ret)
arrtemp
end
_length = m_length[]
ret2
end
Expand All @@ -2043,7 +2051,11 @@ $(Expr(:toplevel, quote
function get_strv(instance::GVariant)
m_length = Ref{UInt64}()
ret = ccall(("g_variant_get_strv", libglib), Ptr{Cstring}, (Ptr{GVariant}, Ptr{UInt64}), instance, m_length)
ret2 = bytestring.(unsafe_wrap(Vector{Cstring}, ret, m_length[]), true)
ret2 = begin
arrtemp = bytestring.(unsafe_wrap(Vector{Cstring}, ret, m_length[]), false)
GLib.g_free(ret)
arrtemp
end
_length = m_length[]
ret2
end
Expand Down

0 comments on commit bb1088d

Please sign in to comment.