Ruby shared_ptr on error code improvement in traits_as::as
This commit is contained in:
parent
83a389d3fb
commit
1a6f8d1e4b
1 changed files with 1 additions and 4 deletions
|
|
@ -87,14 +87,11 @@ namespace swig {
|
||||||
if (SWIG_IsOK(res)) {
|
if (SWIG_IsOK(res)) {
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
// Uninitialized return value, no Type() constructor required.
|
|
||||||
if (throw_error) throw std::invalid_argument("bad type");
|
if (throw_error) throw std::invalid_argument("bad type");
|
||||||
VALUE lastErr = rb_gv_get("$!");
|
VALUE lastErr = rb_gv_get("$!");
|
||||||
if (lastErr == Qnil)
|
if (lastErr == Qnil)
|
||||||
SWIG_Error(SWIG_TypeError, swig::type_name<std::shared_ptr<Type> >());
|
SWIG_Error(SWIG_TypeError, swig::type_name<std::shared_ptr<Type> >());
|
||||||
static std::shared_ptr<Type> *v_def = (std::shared_ptr<Type> *) malloc(sizeof(std::shared_ptr<Type>));
|
return std::shared_ptr<Type>();
|
||||||
memset(v_def,0,sizeof(std::shared_ptr<Type>));
|
|
||||||
return *v_def;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue