[TIMOB-13620] Android: Proxies in modules are not disposed correctly
GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-04-19T23:51:25.000+0000 |
Affected Version/s | Release 3.0.0, Release 3.1.0 |
Fix Version/s | 2013 Sprint 08 Core, 2013 Sprint 08, Release 3.1.1, Release 3.2.0 |
Components | Android |
Labels | qe-closed-3.1.1 |
Reporter | Allen Yeung |
Assignee | Josh Roesslein |
Created | 2013-04-18T21:37:01.000+0000 |
Updated | 2013-06-07T16:46:03.000+0000 |
Description
The app.js in the example folder demonstrates the issue:
Unzip the module
Build the module ('ant')
Create a new Titanium application in Studio
Copy the app.js from the module's example folder into your application
Run the application
Notice that the label displays 'Jeff 555-1212'. The 'Jeff' comes from the propertyAccessor and the '555-1212' comes from the custom property.
Hit the Android Back button (the activity closes but the process is still active)
Tap on the application in the Android app launcher
Notice that the label displays 'undefined 555-1212'. You can also see the 'E/Proxy ( 2221): Unable to lookup Proxy.prototype.getProperty' error message in the log.
For further weirdness, uncomment lines 29-31 in the app.js file and re-run steps 5-8 again. This time you will notice that everything works correctly. The only difference here is that a 2nd instance of the proxy is being created with a call from JS rather than the one that is being created internally.
A couple of observations:
The onStop and onDestroy methods are getting called when the activity closes (check the messages output to the log file)
The process is still active after closing the activity
On the 2nd launch of the main activity you will notice a log message that it is registering an existing module again even though the module was supposedly destroyed. Probably expected behavior, but perhaps not.
I've tried a number of different things but have not been able to change this behavior. Any clues, suggestions, etc. are greatly appreciated.
Attachments
Created [PR #4186](https://github.com/appcelerator/titanium_mobile/pull/4186) for master.
Created [PR #4280](https://github.com/appcelerator/titanium_mobile/pull/4280) to backport fix into 3_1_X.
Verified as fixed. Environment: Appcelerator Studio 3.1.1.201306061938 Titanium SDK 3.1.1.v20130606121419 CLI 3.1.1-cr Alloy 1.1.3-cr Titanium-Code-Processor 1.1.3-cr3 Closing.