Review Request: GluonObject: Fix usage of addChildAt in combination with GameObject

Commit Hook null at kde.org
Mon Nov 7 18:54:05 UTC 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/103054/#review7999
-----------------------------------------------------------


This review has been submitted with commit b704eab0c284036578fbcb1784f73a818c7790ad by Felix Rohrbach to branch master.

- Commit Hook


On Nov. 6, 2011, 2:14 p.m., Felix Rohrbach wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/103054/
> -----------------------------------------------------------
> 
> (Updated Nov. 6, 2011, 2:14 p.m.)
> 
> 
> Review request for Gluon.
> 
> 
> Description
> -------
> 
> This happened when calling addChildAt on a GameObject:
> - GameObject adds the child to an internal list, d->children.
> - GameObject calls GluonObject::addChildAt
> - GluonObject calls addChild. As addChild is virtual,
>   GameObject::addChild is called.
> - GameObject checks whether the child is in d->children. As it is in it,
>    it does nothing. GluonObject::addChild is not called
> 
> There are two options to solve this problem. The first one is to call GluonObject::addChild in GluonObject::addChildAt explicitly. The second is to call GluonObject::addChild in GameObject::addChild every time. I chose the first, as you can't know that GluonObject::addChildAt will call GluonChild::addChild. Additionally, the GluonObject removes children before calling addChild and adds them afterwards, so GluonObject is in an unstable state when calling addChild, which could cause even more confusion for API users. The downside of this option is that the api user has to implement both, addChild and addChildAt.
> 
> 
> Diffs
> -----
> 
>   core/gluonobject.cpp 7248dc1 
> 
> Diff: http://git.reviewboard.kde.org/r/103054/diff/diff
> 
> 
> Testing
> -------
> 
> All tests are succesfull, GluonCreator still starts and a problem I had with prefabs is gone.
> 
> 
> Thanks,
> 
> Felix Rohrbach
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/gluon/attachments/20111107/76d14858/attachment.html>


More information about the Gluon mailing list