qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH qom v1 1/1] qom: object: remove parent pointer when unparenting
Date: Wed, 11 Jun 2014 13:28:11 +0200	[thread overview]
Message-ID: <53983D4B.10304@suse.de> (raw)
In-Reply-To: <CAEgOgz7p7XPJGHSboAff-XUBDtimRR=fay12U4Ctdrp9B2t+tg@mail.gmail.com>

Am 11.06.2014 12:19, schrieb Peter Crosthwaite:
> On Wed, Jun 11, 2014 at 6:13 PM, Andreas Färber <afaerber@suse.de> wrote:
>> Am 27.05.2014 02:39, schrieb Peter Crosthwaite:
>>> Certain parts of the QOM framework test this pointer to determine if
>>> an object is parented. Nuke it when the object is unparented to allow
>>> for reuse of an object after unparenting.
>>>
>>> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>> ---
>>>
>>>  qom/object.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/qom/object.c b/qom/object.c
>>> index e42b254..8319e89 100644
>>> --- a/qom/object.c
>>> +++ b/qom/object.c
>>> @@ -402,6 +402,7 @@ void object_unparent(Object *obj)
>>>      if (obj->parent) {
>>>          object_property_del_child(obj->parent, obj, NULL);
>>>      }
>>> +    obj->parent = NULL;
>>>      object_unref(obj);
>>>  }
>>>
>>
>> This looks okay to me, and it might also help the segfault on hot-unplug
>> Stefan and Kevin reported before I went on travels.
>>
> 
> Welcome back.
> 
>> Any objection to moving this one line up into the if?
>>
> 
> No problem. Will respin.

I've done so myself, but now I wonder why we are checking obj->parent at
all there after we already return if !obj->parent? Is this to guard
against ObjectClass::unparent() changing Object::parent? Either way, the
two variants you posted and I suggested should be fine.

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2014-06-11 11:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <97a5753d0e2e5d8ce43730fb0d8595ceb69261a9.1401151094.git.peter.crosthwaite@xilinx.com>
2014-06-02  0:35 ` [Qemu-devel] [PATCH qom v1 1/1] qom: object: remove parent pointer when unparenting Peter Crosthwaite
2014-06-04  8:21   ` Stefan Hajnoczi
2014-06-11  8:13 ` Andreas Färber
2014-06-11 10:19   ` Peter Crosthwaite
2014-06-11 11:28     ` Andreas Färber [this message]
2014-06-11 11:33       ` Paolo Bonzini
2014-06-11 11:52       ` Peter Crosthwaite

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53983D4B.10304@suse.de \
    --to=afaerber@suse.de \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).