X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0815db26866a57eb72dbda72cc060e2649da45f5..b89f0cb06a187c6fe7e75ab5aa359b019b8ff766:/wxPython/src/controls2.i diff --git a/wxPython/src/controls2.i b/wxPython/src/controls2.i index aa63f8a257..31acadfa5e 100644 --- a/wxPython/src/controls2.i +++ b/wxPython/src/controls2.i @@ -1075,11 +1075,13 @@ public: int rval = 0; bool found; wxPyBeginBlockThreads(); - if ((found = m_myInst.findCallback("OnCompareItems"))) - rval = m_myInst.callCallback(Py_BuildValue( - "(OO)", - wxPyConstructObject((void*)&item1, "wxTreeItemId"), - wxPyConstructObject((void*)&item2, "wxTreeItemId"))); + if ((found = m_myInst.findCallback("OnCompareItems"))) { + PyObject *o1 = wxPyConstructObject((void*)&item1, "wxTreeItemId"); + PyObject *o2 = wxPyConstructObject((void*)&item2, "wxTreeItemId"); + rval = m_myInst.callCallback(Py_BuildValue("(OO)",o1,o2)); + Py_DECREF(o1); + Py_DECREF(o2); + } wxPyEndBlockThreads(); if (! found) rval = wxTreeCtrl::OnCompareItems(item1, item2);