[TIMOB-24756] Android: Ti.UI.ImageView with "images" property causes crash
GitHub Issue | n/a |
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-06-05T22:47:06.000+0000 |
Affected Version/s | Release 6.1.0 |
Fix Version/s | Release 6.1.1 |
Components | Android |
Labels | merge-6.1.1, regression |
Reporter | Joshua A. Ceaser |
Assignee | Yordan Banev |
Created | 2017-05-31T23:09:30.000+0000 |
Updated | 2017-07-03T19:55:11.000+0000 |
Description
I'm getting this exception when running my application on Android with TI SDK 6.1.0. If the images property is set and start has been called, when the window closes you get the below errors. I have attached the controller, view, tss files
{quote}
[ERROR] : TiApplication: (Thread-926) [5221,5221] Sending event: exception on thread: Thread-926 msg:java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object org.appcelerator.titanium.proxy.TiViewProxy.getProperty(java.lang.String)' on a null object reference; Titanium 6.1.0,2017/05/26 15:24,undefined
[ERROR] : TiApplication: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object org.appcelerator.titanium.proxy.TiViewProxy.getProperty(java.lang.String)' on a null object reference
[ERROR] : TiApplication: at ti.modules.titanium.ui.widget.TiUIImageView.getDuration(TiUIImageView.java:465)
[ERROR] : TiApplication: at ti.modules.titanium.ui.widget.TiUIImageView$Loader.run(TiUIImageView.java:406)
[ERROR] : TiApplication: at java.lang.Thread.run(Thread.java:818)
[DEBUG] : Window: Window is closed normally.
[ERROR] : TiApplication: (Timer-0) [51,5272] Sending event: exception on thread: Timer-0 msg:java.lang.NullPointerException: Attempt to invoke virtual method 'boolean org.appcelerator.titanium.proxy.TiViewProxy.fireEvent(java.lang.String, java.lang.Object, boolean)' on a null object reference; Titanium 6.1.0,2017/05/26 15:24,undefined
[ERROR] : TiApplication: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean org.appcelerator.titanium.proxy.TiViewProxy.fireEvent(java.lang.String, java.lang.Object, boolean)' on a null object reference
[ERROR] : TiApplication: at org.appcelerator.titanium.view.TiUIView.fireEvent(TiUIView.java:1958)
[ERROR] : TiApplication: at org.appcelerator.titanium.view.TiUIView.fireEvent(TiUIView.java:1949)
[ERROR] : TiApplication: at ti.modules.titanium.ui.widget.TiUIImageView.fireChange(TiUIImageView.java:503)
[ERROR] : TiApplication: at ti.modules.titanium.ui.widget.TiUIImageView.access$1600(TiUIImageView.java:53)
[ERROR] : TiApplication: at ti.modules.titanium.ui.widget.TiUIImageView$Animator.run(TiUIImageView.java:553)
[ERROR] : TiApplication: at java.util.Timer$TimerImpl.run(Timer.java:284)
[INFO] : Process: Sending signal. PID: 16778 SIG: 9{quote}
Attachments
File | Date | Size |
blue.png | 2017-06-01T14:44:17.000+0000 | 341 |
green.png | 2017-06-01T14:44:17.000+0000 | 342 |
index.js | 2017-05-31T23:07:32.000+0000 | 89 |
index.tss | 2017-05-31T23:07:32.000+0000 | 386 |
index.xml | 2017-05-31T23:07:32.000+0000 | 115 |
red.png | 2017-06-01T14:44:17.000+0000 | 326 |
Some issues that I can see with this test-case: * You are closing the root-window of the application, I guess the issue itself was happening in a sub-window? * The images have spaces in their filenames * Does this only happen on 6.1.0.GA and did it work in 6.0.x? It crashes in [this line](https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIImageView.java#L465) and suspects that the proxy is already null when accessing. Here is an isolated test-case that may reproduce the issue (remember to place the referenced images in your resources directory):
Hans, to answer your questions: * In the application where I observed the issue I open a new window and close the previous one which has this type of image view. * Even if I change the image names, the result is the same * This only happens with 6.1.0.GA if I change back to 6.0.4 it works fine The test case you posted does recreate the issue.
master: https://github.com/appcelerator/titanium_mobile/pull/9103
6_1_X: https://github.com/appcelerator/titanium_mobile/pull/9109
Verified fix in SDK version 6.1.1.v20170605155640 and 6.2.0.v20170605134755. Test and other information can be found at: Master: https://github.com/appcelerator/titanium_mobile/pull/9103 6_1_X: https://github.com/appcelerator/titanium_mobile/pull/9109
This has created a regression issue. Adding
handleStop()
to the release event is causing aNullPointerException
with theorg.appcelerator.titanium.proxy.TiViewProxy.fireEvent
being called on a null reference. For example when anImageView
is being used in aScrollableView
.[~dbankier] Could you provide a test case that reproduces the issue?
Sure: