Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6295] Android: ImageView with image property set to an http source can cause NPE if removed from parent while still downloading content

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-01-05T13:50:27.000+0000
Affected Version/sRelease 1.8.0.1
Fix Version/sSprint 2011-47, Release 1.8.0.1
ComponentsAndroid
Labelsbranch-v8, module_imageview, qe-testadded
ReporterBill Dawson
AssigneeBill Dawson
Created2011-11-23T12:53:45.000+0000
Updated2012-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 calling win.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();

Comments

  1. Bill Dawson 2011-11-23

    Pull request ready https://github.com/appcelerator/titanium_mobile/pull/766
  2. Dustin Hyde 2011-12-06

    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
  3. Dustin Hyde 2012-01-05

    Added label qe-testadded.

JSON Source