]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/msw/controls2.cpp
Fixed a bunch of embarassing reference leaks
[wxWidgets.git] / wxPython / src / msw / controls2.cpp
index c4dbd0eb176022e2b39738dac72f0be454533ed2..9a88d7de7ed87c3423f0dfc47d88322056539519 100644 (file)
@@ -213,11 +213,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);