SWIG_Ruby_ConvertPtrAndOwn may return a SWIG_ObjectPreviouslyDeletedError.
In a method wrapper, such error results are catched like this:
res1 = SWIG_ConvertPtr(self,
&argp1,SWIGTYPE_p_Foo, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1),
Ruby_Format_TypeError( "", "Foo *","DoSomething", 1,
self ));
}
This way the ObjectPreviouslyDeletedError gets a TypeError message which is totally wrong and misleading.
Previous versions of SWIG have thrown an exception with a message like "This Animal * already released" (see ruby documentation.
I think the last working version was 1.3.27. See:
Tobias
There's no testcase here, but looking at the code and its history I think this is still the case, but also it doesn't look to me like this ever actually worked.
To fix,
Ruby_Format_TypeError
could takeres1
as a parameter (and probably get renamed).It'd be really useful to have a way to reproduce the situation where this happens though. It's not clear to me how to trigger it.