appcelerator - Loop while cleanup object (only android) -


i'm facing weird bug on android, i've page view has side view (side) loads content view (filter), filter view loads view (form) , last 1 loads views (text)

[info] :   add :: text [info] :   add :: text [info] :   add :: form [info] :   add :: filter [info] :   add :: side 

when close active page view, calls cleanup function on child views:

$.page.cleanup = function() {     side.cleanup(); };  console.log('add :: side'); $.side.cleanup = function() {     console.log('destroy :: side');     filter.cleanup();     //remove listeners, , null objects };  console.log('add :: filter'); $.filter.cleanup = function() {     console.log('destroy :: filter');     form.cleanup();     //remove listeners, , null objects };  console.log('add :: form'); $.form.cleanup = function() {     console.log('destroy :: form');     for(var in text) text[i].cleanup();     //remove listeners, , null objects };  console.log('add :: text'); $.text.cleanup = function() {     console.log('destroy :: text');     //remove listeners, , null objects }; 

but when run cleanup function in android, starts loop, on ios works fine:

ios:

[info] :   cleanup :: side [info] :   cleanup :: filter [info] :   cleanup :: form [info] :   cleanup :: text [info] :   cleanup :: text 

android:

[info] :   cleanup :: side [info] :   cleanup :: filter [info] :   cleanup :: form [info] :   cleanup :: text [info] :   cleanup :: text [info] :   cleanup :: filter [info] :   cleanup :: form [info] :   cleanup :: filter [info] :   cleanup :: form [info] :   cleanup :: filter [info] :   cleanup :: form [info] :   cleanup :: filter [info] :   cleanup :: form ... 

any idea??

by mistake cleaning buttons way:

for(var in $.buttons) $.buttons[i].cleanup(); 

instead of:

for(var in $.buttons.children) $.buttons.children[i].cleanup(); 

don't know why creates loop on filter view cleanup event, solved, answer


Comments