@@ -67,7 +67,7 @@ std::vector<std::shared_ptr<object::__Type>> Schema::getTypes() const
6767
6868std::shared_ptr<object::__Type> Schema::getQueryType () const
6969{
70- return _query. lock () ;
70+ return _query;
7171}
7272
7373std::shared_ptr<object::__Type> Schema::getMutationType () const
@@ -236,7 +236,12 @@ UnionType::UnionType(std::string name, std::string description)
236236
237237void UnionType::AddPossibleTypes (std::vector<std::shared_ptr<object::__Type>> possibleTypes)
238238{
239- _possibleTypes = std::move (possibleTypes);
239+ _possibleTypes.resize (possibleTypes.size ());
240+ std::transform (possibleTypes.cbegin (), possibleTypes.cend (), _possibleTypes.begin (),
241+ [](const std::shared_ptr<object::__Type>& shared)
242+ {
243+ return shared;
244+ });
240245}
241246
242247__TypeKind UnionType::getKind () const
@@ -255,7 +260,11 @@ std::unique_ptr<std::vector<std::shared_ptr<object::__Type>>> UnionType::getPoss
255260{
256261 std::unique_ptr<std::vector<std::shared_ptr<object::__Type>>> result (new std::vector<std::shared_ptr<object::__Type>>(_possibleTypes.size ()));
257262
258- std::copy (_possibleTypes.cbegin (), _possibleTypes.cend (), result->begin ());
263+ std::transform (_possibleTypes.cbegin (), _possibleTypes.cend (), result->begin (),
264+ [](const std::weak_ptr<object::__Type>& weak)
265+ {
266+ return weak.lock ();
267+ });
259268
260269 return result;
261270}
@@ -347,7 +356,7 @@ __TypeKind WrapperType::getKind() const
347356
348357std::shared_ptr<object::__Type> WrapperType::getOfType () const
349358{
350- return _ofType;
359+ return _ofType. lock () ;
351360}
352361
353362Field::Field (std::string name, std::string description, std::unique_ptr<std::string>&& deprecationReason, std::vector<std::shared_ptr<InputValue>> args, std::shared_ptr<object::__Type> type)
@@ -382,7 +391,7 @@ std::vector<std::shared_ptr<object::__InputValue>> Field::getArgs() const
382391
383392std::shared_ptr<object::__Type> Field::getType () const
384393{
385- return _type;
394+ return _type. lock () ;
386395}
387396
388397bool Field::getIsDeprecated () const
@@ -419,7 +428,7 @@ std::unique_ptr<std::string> InputValue::getDescription() const
419428
420429std::shared_ptr<object::__Type> InputValue::getType () const
421430{
422- return _type;
431+ return _type. lock () ;
423432}
424433
425434std::unique_ptr<std::string> InputValue::getDefaultValue () const
0 commit comments