diff --git a/jlqml.hpp b/jlqml.hpp index 8bbd7d5..c8f23c2 100644 --- a/jlqml.hpp +++ b/jlqml.hpp @@ -10,8 +10,15 @@ namespace qmlwrap // Helper to store a Julia value of type Any in a GC-safe way struct QVariantAny { - QVariantAny(jl_value_t* v); - ~QVariantAny(); + inline QVariantAny(jl_value_t* v) + { + assert(v != nullptr); + jlcxx::protect_from_gc(value); + } + inline ~QVariantAny() + { + jlcxx::unprotect_from_gc(value); + } jl_value_t* value; }; diff --git a/wrap_qml.hpp b/wrap_qml.hpp index 12e8704..1459ae0 100644 --- a/wrap_qml.hpp +++ b/wrap_qml.hpp @@ -64,16 +64,6 @@ template<> struct SuperType { using type = QQuickIm namespace qmlwrap { -inline QVariantAny::QVariantAny(jl_value_t* v) : value(v) -{ - assert(v != nullptr); - jlcxx::protect_from_gc(value); -} -inline QVariantAny::~QVariantAny() -{ - jlcxx::unprotect_from_gc(value); -} - using qvariant_types = jlcxx::ParameterList, JuliaDisplay*, JuliaCanvas*, JuliaPropertyMap*, QObject*>;