Object lifetime problem with CxxWrap and make_const_array

The tests of the FastJet package expose that problem. If you look at https://github.com/jstrube/FastJet.jl/blob/main/test/runtests.jl#L39 and line 54, I’m printing a property of that object to keep it around.
Removing that print (sometimes) leads to the problem I’m seeing. GC.enable(false) “fixes” it, but that’s obviously no solution for long-running processes. GC.@preserve did not work for me.
The gcprotect function sounds interesting, thanks for the tip. I’ll look into it, but figuring out when to unprotect might be challenging, not sure.