diff --git a/src/js_list.hpp b/src/js_list.hpp index d936159c..52fe358c 100644 --- a/src/js_list.hpp +++ b/src/js_list.hpp @@ -41,7 +41,7 @@ struct ListClass : ClassDefinition> { using Value = js::Value; using ReturnValue = js::ReturnValue; - static ObjectType create_instance(ContextType, realm::List &); + static ObjectType create_instance(ContextType, realm::List); // properties static void get_length(ContextType, ObjectType, ReturnValue &); @@ -81,8 +81,8 @@ struct ListClass : ClassDefinition> { }; template -typename T::Object ListClass::create_instance(ContextType ctx, realm::List &list) { - return create_object>(ctx, new realm::List(list)); +typename T::Object ListClass::create_instance(ContextType ctx, realm::List list) { + return create_object>(ctx, new realm::List(std::move(list))); } template diff --git a/src/js_object_accessor.hpp b/src/js_object_accessor.hpp index 4809f23a..dead643e 100644 --- a/src/js_object_accessor.hpp +++ b/src/js_object_accessor.hpp @@ -135,7 +135,7 @@ struct NativeAccessor { return Object::validated_get_object(ctx, Value::validated_to_object(ctx, value), (uint32_t)index); } static ValueType from_list(ContextType ctx, realm::List list) { - return ListClass::create_instance(ctx, list); + return ListClass::create_instance(ctx, std::move(list)); } static Mixed to_mixed(ContextType ctx, ValueType &val) {