diff options
| author | Christoph Reiter <reiter.christoph@gmail.com> | 2018-05-04 21:29:13 +0200 |
|---|---|---|
| committer | Christoph Reiter <reiter.christoph@gmail.com> | 2018-05-04 21:35:02 +0200 |
| commit | dd2a6c36b2a8960d05b81d46fb6b1cc063222497 (patch) | |
| tree | 4338f98aa096ed6a7e0eca2a8020dd5981aca4ef /gi/pygi-boxed.c | |
| parent | b4417a4432fe96ce545ecaf61fc7d2d745020614 (diff) | |
| download | pygobject-dd2a6c36b2a8960d05b81d46fb6b1cc063222497.tar.gz | |
Don't crash on multiple calls to GObject.Value.__del__. See !66
After chaining up accessing anything on the instance will crash like
accessing self.g_type in this case. Guard against that by exposing if the
wrapped boxed is still there.
Ideally we shouldn't invalidate the object in __del__, but various
things depend on it atm. For another time..
Diffstat (limited to 'gi/pygi-boxed.c')
| -rw-r--r-- | gi/pygi-boxed.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gi/pygi-boxed.c b/gi/pygi-boxed.c index d4823263..6a48159f 100644 --- a/gi/pygi-boxed.c +++ b/gi/pygi-boxed.c @@ -193,6 +193,12 @@ boxed_get_free_on_dealloc(PyGIBoxed *self, void *closure) return pygi_gboolean_to_py( ((PyGBoxed *)self)->free_on_dealloc ); } +static PyObject * +boxed_get_is_valid (PyGIBoxed *self, void *closure) +{ + return pygi_gboolean_to_py (pyg_boxed_get_ptr (self) != NULL); +} + /** * pygi_boxed_copy_in_place: * @@ -219,6 +225,7 @@ pygi_boxed_copy_in_place (PyGIBoxed *self) static PyGetSetDef pygi_boxed_getsets[] = { { "_free_on_dealloc", (getter)boxed_get_free_on_dealloc, (setter)0 }, + { "_is_valid", (getter)boxed_get_is_valid, (setter)0 }, { NULL, 0, 0 } }; |
