Skip to content

Commit 45b1a19

Browse files
authored
Add GC preserve to prevent segfaults (#182)
1 parent 7e1e4e0 commit 45b1a19

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/core.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ for (x, name) in [(:(<:Any), :Object),
475475
function _jcall(obj::T, jmethodId::Ptr{Nothing}, rettype::Type{$x},
476476
argtypes::Tuple, args...; callmethod=$callmethod) where T <: $t
477477
savedArgs, convertedArgs = convert_args(argtypes, args...)
478-
GC.@preserve savedArgs begin
478+
GC.@preserve obj savedArgs convertedArgs begin
479479
result = callmethod(Ptr(obj), jmethodId, Array{JNI.jvalue}(jvalue.(convertedArgs)))
480480
end
481481
cleanup_arg.(convertedArgs)

0 commit comments

Comments
 (0)