On Tue, Jul 14, 2009 at 1:44 AM, Rafael Antognolli<antogno...@profusion.mobi> wrote: > Hi, > > Does anyone knows if the function eina_inlist_remove() should return > NULL if the item trying to be removed isn't inserted on the list? (ie. > item->prev == item->next == item->last == NULL)
This is an error on user part. But we should add SAFETY_CHECK checking if item->last == list->last, returning list if fails. > Taking a look at the code I saw that if that item isn't inside any > list, the item->next is returned (line 262), but item->next is NULL. this is correct, if there is previous, you return it, otherwise you return next, be it NULL or not. This a cheap removal, you have to believe given item is in list, otherwise you'd have to walk the whole list, checking for item. > This is causing me some trouble because when I call ecore_evas_free() > on an ecore_evas_buffer that has an added ecore_evas_object_image on > it, the function _ecore_evas_free() is called first on the > sub_ecore_evas and then on the ecore_evas_buffer. so far, so good, it is expected to have it in this order (list is prepend(), not append()) so topmost items are deleted first. > But the > sub_ecore_evas isn't added to the ecore_evases inlist (inside > ecore_evas_buffer.c), then the eina_inlist_remove() on the line 32 > (same file) returns NULL. Later when the _ecore_evas_free() is finally > called on the ecore_evas_buffer (the first one), the ecore_evases > inlist points to NULL, causing a safety check fail. Uh oh, something bad here. It is being added! sub ecore evas (the one of image object) is created but not added to ecore_evases. Either we add new canvases to ecore_evases or flag it as subcanvas (maybe just look for ee->engine.buffer.image != NULL and Ecore_Evas_Parent in it). > Maybe the eina_inlist_remove() function should just return the list > itself if the item isn't inside any list, or the > ecore_evas_object_image_new() function should add the sub ecore_evas > that has been just created to the ecore_evases inlist. > > Any ideas? silencing the problem in eina_inlist_remove() is bad... I'll commit another safety checking to make it louder (check if last is the same). I'll wait raster to comment if it's better to add to ecore_evases or to check if it's a subcanvas or not. -- Gustavo Sverzut Barbieri http://profusion.mobi embedded systems -------------------------------------- MSN: barbi...@gmail.com Skype: gsbarbieri Mobile: +55 (19) 9225-2202 ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel