On Sun, Nov 8, 2009 at 11:50 AM, Enlightenment SVN <no-re...@enlightenment.org> wrote:
+ if not callable(callback): + raise TypeError("callback is not callable") you should do this check when you register the callback, not when you call it. Compare: you add one item at most 1 time, but call it multiple (N) times. > - self.item = elm_list_item_append(list.obj, label, icon_obj, end_obj, > _list_callback, NULL) > - self._create_mapping(callback, data) > + self.cbt = (list, callback, data, self) > + self.item = elm_list_item_append(list.obj, label, icon_obj, end_obj, > + _list_callback, <void*>self.cbt) I did not look this carefully, but I bet this is wrong, specially: > + self.cbt = (list, callback, data, self) what's the use of it? If you append 2 times with different parameters, just the last one is kept... worse than this, the old value pointer by elm_list_item_append (C/internal) is the object that will be garbage collected after you assign the new object and make the old loose its last reference. The best solution here is to create the Python object that reference Python function and parameters (your cbt), then Py_INCREF it, then set it as data for C elm_list_item_{append,prepend,insert_before,intert_after}(), then set it as data elm_list_item_del_cb_set(), where you'd Py_DECREF. Of course we need to make sure we're calling del cb for all paths in Elm_list... (on object destroy, clear, etc). Also, we need to review this in whole Elementary... it was complicate to get right for evas/edje/ecore, but they are correct now... you need to check them or ask me, if we start to spread minor errors like this then we'll have hard time tracking these beasts after some time. -- Gustavo Sverzut Barbieri http://profusion.mobi embedded systems -------------------------------------- MSN: barbi...@gmail.com Skype: gsbarbieri Mobile: +55 (19) 9225-2202 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel