Fix borrowed reference return in some callbacks
This commit is contained in:
parent
da434dcc64
commit
16b5508233
3 changed files with 177 additions and 15 deletions
|
|
@ -10,10 +10,11 @@ static PyObject* PyDrawable_get_click(PyDrawableObject* self, void* closure)
|
|||
Py_RETURN_NONE;
|
||||
|
||||
PyObject* ptr = self->data->click_callable->borrow();
|
||||
if (ptr && ptr != Py_None)
|
||||
if (ptr && ptr != Py_None) {
|
||||
Py_INCREF(ptr); // Return new reference, not borrowed
|
||||
return ptr;
|
||||
else
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
// Click property setter
|
||||
|
|
|
|||
|
|
@ -259,10 +259,11 @@ PyObject* UIDrawable::get_click(PyObject* self, void* closure) {
|
|||
PyErr_SetString(PyExc_TypeError, "no idea how you did that; invalid UIDrawable derived instance for _get_click");
|
||||
return NULL;
|
||||
}
|
||||
if (ptr && ptr != Py_None)
|
||||
if (ptr && ptr != Py_None) {
|
||||
Py_INCREF(ptr); // Return new reference, not borrowed
|
||||
return ptr;
|
||||
else
|
||||
return Py_None;
|
||||
}
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
int UIDrawable::set_click(PyObject* self, PyObject* value, void* closure) {
|
||||
|
|
@ -1615,10 +1616,11 @@ PyObject* UIDrawable::get_on_enter(PyObject* self, void* closure) {
|
|||
PyErr_SetString(PyExc_TypeError, "Invalid UIDrawable derived instance for on_enter");
|
||||
return NULL;
|
||||
}
|
||||
if (ptr && ptr != Py_None)
|
||||
if (ptr && ptr != Py_None) {
|
||||
Py_INCREF(ptr); // Return new reference, not borrowed
|
||||
return ptr;
|
||||
else
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
int UIDrawable::set_on_enter(PyObject* self, PyObject* value, void* closure) {
|
||||
|
|
@ -1698,10 +1700,11 @@ PyObject* UIDrawable::get_on_exit(PyObject* self, void* closure) {
|
|||
PyErr_SetString(PyExc_TypeError, "Invalid UIDrawable derived instance for on_exit");
|
||||
return NULL;
|
||||
}
|
||||
if (ptr && ptr != Py_None)
|
||||
if (ptr && ptr != Py_None) {
|
||||
Py_INCREF(ptr); // Return new reference, not borrowed
|
||||
return ptr;
|
||||
else
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
int UIDrawable::set_on_exit(PyObject* self, PyObject* value, void* closure) {
|
||||
|
|
@ -1790,10 +1793,11 @@ PyObject* UIDrawable::get_on_move(PyObject* self, void* closure) {
|
|||
PyErr_SetString(PyExc_TypeError, "Invalid UIDrawable derived instance for on_move");
|
||||
return NULL;
|
||||
}
|
||||
if (ptr && ptr != Py_None)
|
||||
if (ptr && ptr != Py_None) {
|
||||
Py_INCREF(ptr); // Return new reference, not borrowed
|
||||
return ptr;
|
||||
else
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
int UIDrawable::set_on_move(PyObject* self, PyObject* value, void* closure) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue