File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1
1
#include "pycall_internal.h"
2
2
3
+ static ID id_gcguard_table ;
4
+
3
5
struct gcguard {
4
6
st_table * guarded_objects ;
5
7
};
@@ -24,6 +26,7 @@ gcguard_free(void* ptr)
24
26
{
25
27
struct gcguard * gg = (struct gcguard * )ptr ;
26
28
st_free_table (gg -> guarded_objects );
29
+ rb_ivar_set (mPyCall , id_gcguard_table , Qnil );
27
30
}
28
31
29
32
static size_t
@@ -69,7 +72,6 @@ gcguard_delete(VALUE gcguard, PyObject *pyptr)
69
72
}
70
73
}
71
74
72
- static ID id_gcguard_table ;
73
75
static PyObject * weakref_callback_pyobj ;
74
76
static PyObject * gcguard_weakref_destroyed (PyObject * self , PyObject * weakref );
75
77
98
100
pycall_gcguard_delete (PyObject * pyobj )
99
101
{
100
102
VALUE gcguard = rb_ivar_get (mPyCall , id_gcguard_table );
101
- gcguard_delete (gcguard , pyobj );
103
+ if (!NIL_P (gcguard )) {
104
+ gcguard_delete (gcguard , pyobj );
105
+ }
102
106
}
103
107
104
108
void
You can’t perform that action at this time.
0 commit comments