Skip to content

Commit

Permalink
Reenable finalizer to call rsvg_handle_free
Browse files Browse the repository at this point in the history
  • Loading branch information
davidanthoff committed Jun 9, 2018
1 parent 4474c99 commit 1b89a43
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
7 changes: 7 additions & 0 deletions src/calls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,10 @@ end
handle_new_from_data(data::AbstractString)
"""
handle_new_from_data(data::AbstractString) = handle_new_from_data(data::AbstractString,GError(0,0,0))

"""
handle_free(handle::RsvgHandle)
"""
function handle_free(handle::RsvgHandle)
ccall((:rsvg_handle_free,librsvg), Void, (RsvgHandle,), handle)
end
18 changes: 9 additions & 9 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ type RsvgHandle

function RsvgHandle(ptr::Ptr{Void})
self = new(ptr)
#finalizer(self, destroy)
finalizer(self, destroy)
self
end
end

# function destroy(handle::RsvgHandle)
# if handle.ptr == C_NULL
# return
# end
# Gtk.GLib.gc_unref(handle)
# handle.ptr = C_NULL
# nothing
# end
function destroy(handle::RsvgHandle)
if handle.ptr == C_NULL
return
end
handle_free(handle)
handle.ptr = C_NULL
nothing
end

"""
RsvgDimensionData is a simple struct of
Expand Down

0 comments on commit 1b89a43

Please sign in to comment.