On Fri, Feb 8, 2008 at 11:58 AM, Emmanuele Bassi <[EMAIL PROTECTED]> wrote:
>  > > Output:
>  > > INIT <__main__.AnimatedLabel instance at 0xb65cee4c>
>  > > #alph: 481
>  >
>  > eeek.
>  >
>  > each python wrapper around alpha functions from the clutter module is
>  > nothing more than a glorified function call:
>  >
>  >         py_alpha = PyTuple_GetItem (args, 0);
>
>  and this leads me to wonder if this bug:
>
>   http://bugs.python.org/issue1123430
>
>  is playing tricks on us.


I got some free time to get back to this problem and I think I found
couple places that look like they miss updating reference counts.
There still seems to be some leaks left but the biggest problems seem
to be gone, at least according to my current test case.

Here's my current patch for the trunk.  I submitted this as bug #797
but I post it here too in hope somebody else could test it too
(Ashwin?).

--
Tero

--- bindings/pyclutter/clutter/pyclutter.c      (revision 2163)
+++ bindings/pyclutter/clutter/pyclutter.c      (working copy)
@@ -98,6 +98,7 @@ pyclutter_callback_invoke (PyClutterCall
                         PyObject *param = va_arg (var_args, PyObject*);

                         PyTuple_SetItem (args, i, param);
+                       Py_INCREF(param);
                 }
         }
         else {
@@ -109,10 +110,13 @@ pyclutter_callback_invoke (PyClutterCall
         /* append the data */
         if (cb->data) {
                 PyTuple_SetItem (args, i, cb->data);
+                Py_INCREF(cb->data);
         }

         retobj = PyObject_CallObject (cb->func, args);

+       Py_XDECREF(args);
+
         return retobj;
 }

@@ -267,6 +271,7 @@ pyclutter_alpha_func (ClutterAlpha *alph
         }

         Py_XDECREF (retobj);
+       Py_XDECREF (py_alpha);

         pyg_gil_state_release (state);

@@ -289,6 +294,7 @@ pyclutter_effect_complete (ClutterActor
                 PyErr_Print ();

         Py_XDECREF (retobj);
+       Py_XDECREF (py_actor);

         pyg_gil_state_release (state);
-- 
To unsubscribe send a mail to [EMAIL PROTECTED]

Reply via email to