On 25/02/13 08:55, Paolo Bonzini wrote:
> 
>> Another thing is, that  qdev_free looks now different, some days ago
>> it also did an unref. As far as I can see the object_unparent in
>> virtio-ccw was always the wrong thing to do.
> 
> object_unparent is "almost" idempotent, i.e. idempotent as long as it does
> not cause the last reference to go away.  So, doing an object_unparent
> before qdev_free was not wrong when qdev_free did an object_unref.


Hmm, the old sequence was 

     object_unparent(OBJECT(dev));
     qdev_free(dev) ---+
                       |
                       V
...
             object_unparent(OBJECT(dev));  now the last reference is gone, 
object is freed
             object_unref(OBJECT(dev));     now the reference of a deleted 
object becomes -1
...

Isnt that a problem in itself that we modify a reference counter in an deleted 
object?



> 
> I think qdev_free is better, unless we want to change all of them
> at the same time.


Ok, so we leave the patch as is.

Christian


Reply via email to