updates still occurring after removeAllSystems

47 views
Skip to first unread message

John Nyquist

unread,
Feb 21, 2015, 1:35:42 PM2/21/15
to ash-fr...@googlegroups.com
After a call to removeAllSystems, my systems are getting update signals. This is because I'm calling removeAllSystems during an update. So while removeAllSystems clears out the systemList (its head and tail are null), all the system nodes still have their next value (yet their previous fields are null).

I guess my expectation was that when you call removeAllSystems, it would immediately remove them and send no more update signals. 

Damion Murray

unread,
Feb 21, 2015, 3:21:19 PM2/21/15
to ash-fr...@googlegroups.com
I suspect you may need to disable frame updates prior to calling removeAllSystems().

John Nyquist

unread,
Feb 21, 2015, 8:22:12 PM2/21/15
to ash-fr...@googlegroups.com
Yes, that would do it. :-)
But do you think that the systems ought to have their next field set to null also?

Damion Murray

unread,
Feb 22, 2015, 10:39:21 AM2/22/15
to ash-fr...@googlegroups.com

I don't think that's necessary. When you call removeSystems() the system is removed from the system list so the engine won't be able to call update on it. If you chose to add a system back to the system list the system's next and previous properties are reset. So you should be good :).

Hmm... got me thinking about another issue related to systems....I'll go start a new thread for discussion.

On Saturday, February 21, 2015 at 1:35:42 PM UTC-5, John Nyquist wrote:

Richard

unread,
Feb 22, 2015, 11:37:44 AM2/22/15
to ash-fr...@googlegroups.com
John, removeAllSystems should behave as you expect. However, fixing it isn't as simple as setting next to null when removing a system.

The reason next isn't cleared when a system is removed is so you can remove the current system and the loop will still continue to the next system (node lists work this way also). Obviously this isn't what you want when removing the next system as well so it will need some sort of a fix to handle that case.

John Nyquist

unread,
Feb 22, 2015, 1:19:09 PM2/22/15
to ash-fr...@googlegroups.com
Yet update is being called on the next system because the next field in each of the systems in the systemList still has a value after the removeAllSystems is called (yet the previous field in each has been set to null).

John Nyquist

unread,
Feb 22, 2015, 1:25:01 PM2/22/15
to ash-fr...@googlegroups.com
I agree. I guess this might be a distinction between removeSystem vs removeAllSystems. Perhaps removeAllSystems should take that extra step.  If one does want to do a removeAllSystems currently, we need to stop the systems from getting the update signal as well (stopping the frameTickProvider) to avoid unwanted updates.

Richard

unread,
Feb 27, 2015, 1:50:40 PM2/27/15
to ash-fr...@googlegroups.com
Hi John

I just committed the fix for this.

Richard

John Nyquist

unread,
Mar 2, 2015, 12:12:22 PM3/2/15
to ash-fr...@googlegroups.com
Great, thanks Richard!
Reply all
Reply to author
Forward
0 new messages