[TIMOB-6295] Android: ImageView with image property set to an http source can cause NPE if removed from parent while still downloading content
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-01-05T13:50:27.000+0000 |
Affected Version/s | Release 1.8.0.1 |
Fix Version/s | Sprint 2011-47, Release 1.8.0.1 |
Components | Android |
Labels | branch-v8, module_imageview, qe-testadded |
Reporter | Bill Dawson |
Assignee | Bill Dawson |
Created | 2011-11-23T12:53:45.000+0000 |
Updated | 2012-11-02T19:04:50.000+0000 |
Description
http://pastie.org/pastes/2909794/text
Fail case / Test case
* Run the app.js below as your application. * After the "good" image loads, click the "test" button. * In the fail case, the app will crash. *Expected behavior*: ImageView disappears (because we're callingwin.remove(imageView)
and the app will not crash.
app.js
var win = Titanium.UI.createWindow({
title:'Test',
backgroundColor:'#000',
exitOnClose: true
});
var btnAdd, imageView
win.add(btnAdd = Ti.UI.createButton({
title: "Test",
left: "10dp", width: "150dp", bottom: "5dp", height: "40dp"
}));
win.add(imageView = Ti.UI.createImageView({
image: "http://www.appcelerator.com/wp-content/themes/appcelerator/img/werehiring_sticker.png",
width: "86dp", height: "84dp"
}));
btnAdd.addEventListener("click", function() {
imageView.image = "http://www.google.com";
win.remove(imageView);
});
win.open();
Pull request ready https://github.com/appcelerator/titanium_mobile/pull/766
Bug fixed. Verified on: SDK: 1.8.0.1.v20111205164258 Runtimes: Android V8/Rhino Studio: 1.0.7.201112052104 OS: OS X Lion Devices Tested: Nexus One 2.2.2, Droid3 2.3.4, G Slate 3.1, Emulator 4.0
Added label qe-testadded.