Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-6295

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

    Details

      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

      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();
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                billdawson Bill Dawson
                Reporter:
                billdawson Bill Dawson
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-5325
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration