[TIMOB-25636] Android: Calling ScrollableView's setters causes a crash if parent window is closed as of 7.0.0
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-05-16T00:00:27.000+0000 |
Affected Version/s | Release 7.0.1 |
Fix Version/s | Release 7.3.0 |
Components | Android |
Labels | ScrollableView, android |
Reporter | Aminul Islam |
Assignee | Joshua Quick |
Created | 2017-12-28T16:44:50.000+0000 |
Updated | 2018-05-16T00:00:30.000+0000 |
Description
Hi,
We are migrating our app from 6.3.0GA Ti SDK to 7.0.0.GA SDK and we are facing couple of issues:
1. In a window, we are using scrollable view and on close of window we are emptying the views of scrollable view by using scrollableView.views = []. with 6.3.0.GA it is working fine but with 7.0.0.GA we are getting error stating
“TiApplication: (main) [16638,27440] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to destroy activity {com.hthworldwide.GeoBlue/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void ti.modules.titanium.ui.widget.TiUIScrollableView.setViews(java.lang.Object)' on a null object reference; Titanium 7.0.1,2017/12/18 10:42,undefined”
2. In a window, we are using activity indicator and on close of that window we are hiding activity indicator by activityIndicator.hide(). with 6.3.0.GA it is working fine but with 7.0.0.GA we are getting error stating
“TiApplication(16766): (main) [21008,142400] Sending event: exception on thread: main msg:java.lang.NullPointerException: Attempt to invoke virtual method 'void ti.modules.titanium.ui.widget.TiUIActivityIndicator.hide()' on a null object reference; Titanium 7.0.1,2017/12/18 10:42,undefined”
Steps to reproduce the issues:
1. Create a sample classic project
2. Copy the attached files and paste them into resources folder
3. Run the App on android device
4. Click on the label “click to view scrollable window”, once window is opened click on android back button.
5. Click on label “click to show indicator”, once window is opened click on android back button.
Note : This is an issue in android platform.
Even tried with 7.0.1.GA sdk still we are facing these issues.
Attachments
File | Date | Size |
---|---|---|
activityIndWin.js | 2017-12-28T16:43:41.000+0000 | 847 |
app.js | 2017-12-28T16:43:41.000+0000 | 567 |
ScrollableViewCloseTest.js | 2018-05-03T23:37:33.000+0000 | 739 |
scrollableWin.js | 2017-12-28T16:43:41.000+0000 | 831 |
I'm able to reproduce this issue in Titanium 7.0.0 with the following code:
*Result:* Crashes with exception...
*Cause:* The native view has been released and null-out when its parent window was closed. The above code's setters and methods should no-op in this case. Note that this is not an issue in Titanium versions older than 7.0.0. *Work-Around:* Don't call the ScrollableView's setters and methods once its parent window has been closed. For example, you don't need to set its child views to [] to release the child references since their references are already released automatically.
PR (master): https://github.com/appcelerator/titanium_mobile/pull/9696
This issue is only reproducible in Titanium 7.0.0 and 7.0.1. This issue is not reproducible in 7.0.2 and 7.1.0. It was inadvertently fixed by a change in 7.0.2. Closing as resolved.