Skip to content

Commit 5a22e4a

Browse files
committed
Fix null SP return
1 parent 51e49a3 commit 5a22e4a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/fortran/boost_shared_ptr.i

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,13 @@
101101
/* -------------------------------------------------------------------------
102102
* Original class by reference. Add null checks.
103103
* ------------------------------------------------------------------------- */
104-
%typemap(in, noblock=1, fragment="SWIG_check_sp_nonnull") CONST TYPE& {
104+
%typemap(in, noblock=1, fragment="SWIG_check_sp_nonnull") CONST TYPE & {
105105
SWIG_check_sp_nonnull($input->cptr, "$1_ltype", "$fclassname", "$decl", return $null)
106106
$1 = (TYPE*)static_cast<SWIGSP__*>($input->cptr)->get();
107107
}
108108

109+
%typemap(in) CONST TYPE &ASSIGNMENT_OTHER = SWIGTYPE *ASSIGNMENT_SELF;
110+
109111
// Output value is never null. Because we're allocating a shared pointer, we set the memory ownership to MOVE so that the *SP*
110112
// will be properly deallocated. But we also must use a null deleter so that when the SP is deleted the corresponding memory
111113
// will not be.

0 commit comments

Comments
 (0)