summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Feltman <sfeltman@src.gnome.org>2013-07-27 21:10:07 -0700
committerSimon Feltman <sfeltman@src.gnome.org>2013-07-27 21:10:32 -0700
commit3c83bfb14b850670eb7c0208e55c120ca203f8af (patch)
tree322dcb5149c705b00fc2df361daf7adb565fccaf
parentf5e3876dee512ca82af6ea798b10d5ecad785dd1 (diff)
downloadpygobject-3c83bfb14b850670eb7c0208e55c120ca203f8af.tar.gz
Use Py_CLEAR for closure cleanup instead of test with Py_DECREF
-rw-r--r--gi/pygi-closure.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c
index 99e15a11..601db94b 100644
--- a/gi/pygi-closure.c
+++ b/gi/pygi-closure.c
@@ -518,15 +518,8 @@ _pygi_invoke_closure_clear_py_data(PyGICClosure *invoke_closure)
{
PyGILState_STATE state = PyGILState_Ensure();
- if (invoke_closure->function != NULL) {
- Py_DECREF (invoke_closure->function);
- invoke_closure->function = NULL;
- }
-
- if (invoke_closure->user_data != NULL) {
- Py_DECREF (invoke_closure->user_data);
- invoke_closure->user_data = NULL;
- }
+ Py_CLEAR (invoke_closure->function);
+ Py_CLEAR (invoke_closure->user_data);
PyGILState_Release (state);
}