Skip to content

Commit

Permalink
add some needed gc protection (oscar-system#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
tthsqe12 committed Mar 23, 2021
1 parent 4cc6de2 commit 4e3e35c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/libsingular/coeffs.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# initialise a number from an mpz
function n_InitMPZ(b::BigInt, cf::coeffs_ptr)
bb = pointer_from_objref(b)
return n_InitMPZ_internal(bb, cf)
GC.@preserve b begin
bb = pointer_from_objref(b)
return n_InitMPZ_internal(bb, cf)
end
end

# get an mpz from a number
function n_GetMPZ(s::number_ptr, r::coeffs_ptr)
res = BigInt(1)
resp = pointer_from_objref(res)
n_GetMPZ_internal(resp, s, r)
GC.@preserve res begin
resp = pointer_from_objref(res)
n_GetMPZ_internal(resp, s, r)
end
return res
end

Expand Down

0 comments on commit 4e3e35c

Please sign in to comment.