On 21/08/15 17:16, Tom Hacohen wrote:
> On 20/08/15 07:09, Daniel Zaoui wrote:
>> The parent should never be !NULL when reaching the destructor. Imo, this 
>> code has not to be here. Instead, an error message should be displayed in 
>> the case the parent is still connected to the object. There is a bug but 
>> definitely the solution doesn't have to be here.
>> I think this issue may happen if eo_del is never called and eo_unref is 
>> called instead. We need to check inside _eo_unref that the parent is NULL 
>> and display an error message.
>>
>> Tom, any thoughts?
>
> Sorry it took me so long to reply, I was busy with some urgent matters.
>
> I agree with Daniel here. It's exactly what I separately said on IRC. I
> think it's not a bug in Eo but a bug in the application. There are two
> valid cases in which an object with a parent is deleted:
> 1. The parent is deleted - when this happens, the child's parent will be
> NULL and thus the error case described is not relevant.
> 2. eo_del() is called on the object - eo_del() clears the parent, so in
> this case, the parent will be null for the destructor too.
>
> Thus, the only case in which the destructor will be called while the
> parent is NULL is an error case, when someone unrefs an object too much
> (i.e unrefs a ref it doesn't hold). This case is a user error and should
> result in an error message. Not a cleanup like this patch does. I think
> it's wrong and should be removed, and an error message should be added,
> or in other words, "what daniel said".

Or more correctly, clean up the error (i.e remove it from the parent) 
and trigger an error message to alert the user.

--
Tom.


------------------------------------------------------------------------------
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to