solve possible seg. faults and directors #1080075
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6894 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
0ac8253c3f
commit
544f24441e
7 changed files with 28 additions and 24 deletions
|
|
@ -62,7 +62,7 @@
|
|||
%define PYPTR_DIRECTOROUT_TYPEMAP(asptr_meth,pyfrag,Type...)
|
||||
%typemap(directorargout,fragment=pyfrag) Type *DIRECTOROUT ($*1_ltype temp) {
|
||||
Type *ptr = 0;
|
||||
int res = asptr_meth($input, &ptr);
|
||||
int res = $input ? asptr_meth($input, &ptr) : 0;
|
||||
if (!res || !ptr)
|
||||
throw Swig::DirectorTypeMismatchException("Error converting Python object using asptr_meth");
|
||||
temp = *ptr;
|
||||
|
|
@ -71,7 +71,7 @@
|
|||
}
|
||||
%typemap(directorout,fragment=pyfrag) Type {
|
||||
Type *ptr = 0;
|
||||
int res = asptr_meth($input, &ptr);
|
||||
int res = $input ? asptr_meth($input, &ptr) : 0;
|
||||
if (!res || !ptr)
|
||||
throw Swig::DirectorTypeMismatchException("Error converting Python object using asptr_meth");
|
||||
$result = *ptr;
|
||||
|
|
@ -79,7 +79,7 @@
|
|||
}
|
||||
%typemap(directorout,fragment=pyfrag,warning="470:Possible thread/reentrant unsafe wrapping, consider using a plain '"#Type"' return type instead.") const Type& {
|
||||
Type *ptr = 0;
|
||||
int res = asptr_meth($input, &ptr);
|
||||
int res = $input ? asptr_meth($input, &ptr) : 0;
|
||||
if (!res || !ptr)
|
||||
throw Swig::DirectorTypeMismatchException("Error converting Python object using asptr_meth");
|
||||
$result = ptr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue