[AC-142] Resursion when setting lifecycleContainer
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Cannot Reproduce |
Resolution Date | 2015-11-14T01:50:13.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | android, lifecycle, titanium |
Reporter | Seth Benjamin |
Assignee | Shak Hossain |
Created | 2015-05-26T20:55:41.000+0000 |
Updated | 2015-11-14T01:51:32.000+0000 |
Description
*Problem*
Setting the lifecycleContainer property of a TiViewProxy and adding it as a child of the lifecycleContainer creates an infinite loop when logging.
*Test Case*
var window = Ti.UI.createWindow();
var view = Ti.UI.createView({ lifecycleContainer: window });
window.add(view);
console.log(window);
[~animecyc] Per documentation, please be sure that you are doing this: {quote} If this property is set to a Window or TabGroup, then the corresponding Activity lifecycle event callbacks will also be called on the proxy. Proxies that require the activity lifecycle will need this property set to the appropriate containing Window or TabGroup. {quote} If you are following the documentation, please provide a full test case to reproduce the issue Best
@Radamantis Torres-Lechuga I provided the test case in the description.
[~animecyc] I don't see your Activity lifecycle callbacks in your test case, can you please provide a full runnable test case? Also if you can provide a use case that will help. Best
I don't see how that is relevant to the issue nor is it required to see the bug. For full disclosure I am using the lifecycleContainer in a custom android module. Regardless the issue will persist given my description.
Also, the provided test case exemplifies the issue. Adding callbacks won't remove the infinite loop. From what I've discerned it is because on Android when you log a TiViewProxy it prints all properties set on it's v8 object as well as its TiViewProxy children. Since "lifecycleContainer" sets the window and the window has the TIViewProxy in question as a child we get infinite recursion.
[~animecyc] as you can see in our [documentation](http://docs.appcelerator.com/platform/latest/#!/guide/How_to_Submit_a_Bug_Report-section-29004732_HowtoSubmitaBugReport-SubmittingTickets) , a test case is required, and here's the doc on [how to create a test case](http://docs.appcelerator.com/platform/latest/#!/guide/How_to_Submit_a_Bug_Report-section-29004732_HowtoSubmitaBugReport-CreatingaTestCase) Thanks
What am I missing that is not already there? From the article you provided it hits all the points needed for a test case: The test case is in the description, it has the least amount of code required to reproduce the bug, and it has no validation errors. The only thing I can't provide is a log because logging is the issue. I went ahead and added bold text as per the formatting in the article you provided.
We tested the issue using the sample code below. The *lifecycleContainer* property set to the current active instance of a standalone Window and it is working as expected. *Test Environments:* CLI Version :4.1.3 Titanium SDK Version:4.1.1.GA, Emulator :Google Nexus 7 - 5.1.0 - API 22 - 800x1280 Appc Studio: Appcelerator Studio, build: 4.1.1.201507141126 Alloy: 1.7.6 Mac OS X,Version = 10.10.1. *Test Steps:* 1.Create a classic project 2.Import [Facebook module](http://docs.appcelerator.com/platform/latest/#!/api/Modules.Facebook) into it and paste Facebook app id into /platform/android/res/values/strings.xml 3.In app.js Use the createActivityWorker() method to create a Facebook proxy and Attach the proxy to the Window t, so it does not get garbage collected. 4.Run with sample code. *Test Code:* You may need to add the manifest and application elements. *tiapp.xml*
*app.js*
*strings.xml*