Skip to content

Commit d73ef20

Browse files
committed
octrun.swg: ensure type_id() is set correctly
1 parent cec09a7 commit d73ef20

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

Lib/octave/octrun.swg

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,13 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
10581058
octave_swig_type *ptr;
10591059
public:
10601060
octave_swig_ref(octave_swig_type *_ptr = 0)
1061-
:ptr(_ptr) { }
1061+
:ptr(_ptr)
1062+
{
1063+
// Ensure type_id() is set correctly
1064+
if (t_id == -1) {
1065+
t_id = octave_swig_ref::static_type_id();
1066+
}
1067+
}
10621068

10631069
~octave_swig_ref()
10641070
{ if (ptr) ptr->decref(); }
@@ -1199,8 +1205,13 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
11991205
public:
12001206

12011207
octave_swig_packed(swig_type_info *_type = 0, const void *_buf = 0, size_t _buf_len = 0)
1202-
: type(_type), buf((const char*)_buf, (const char*)_buf + _buf_len) {
1203-
}
1208+
: type(_type), buf((const char*)_buf, (const char*)_buf + _buf_len)
1209+
{
1210+
// Ensure type_id() is set correctly
1211+
if (t_id == -1) {
1212+
t_id = octave_swig_packed::static_type_id();
1213+
}
1214+
}
12041215

12051216
bool copy(swig_type_info *outtype, void *ptr, size_t sz) const {
12061217
if (outtype && outtype != type)

0 commit comments

Comments
 (0)