Code review comment for lp:~pkunal-parmar/ubuntu-calendar-app/TimeLineView

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

> 301 + function destroyAllChilds() {
> 302 + for(var i=0 ; i < children.length ; ++i ) {
> 303 + children[i].destroy(100);
> 304 + }
> 305 + }
>
> Is there a good reason for specifying a delay of 100 msec before each child is
> destroyed?

no, i guess i was just trying to understand how it works with time and without it
>
> Also, this loop is incorrect, as children are destroyed their length
> decreases, but the iterator keeps increasing, and will eventually become
> invalid. You need to do something like this:
>
> while (children.length > 0) {
> children[0].destroy()
> }

   while (children.length > 0) {
     children[0].destroy()
   }

This will create a infinite loop, as we are not removing object from children array/list. we are just destroying object so length of array will not change. so existing loop works fine, but then array length will keep increasing so to reset length i am now resetting array with following statement.

children = [];

« Back to merge proposal