Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8107525

Loading a bad image in the background can prevent future images from loading in the background

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: fx1.2
    • Fix Version/s: fx1.3
    • Component/s: javafx
    • Labels:
      None

      Description

      I was debugging an app at a customer site and we found a weird bug where some images would load up in the background at launch but no new ones would. They would always load fine in the foreground however. After much debugging we determined that loading a bad image, say with a url of "" in the background would kill a worker thread. If you do this enough times (4 appears to be the magic number) then there are no worker threads left to load more images and all background image loading fails. The code below demonstrates this bug. The initial loop creates some bad images. Then you can click on the red rectangle to try loading more images. If you create 3 or less bad images then you are okay. If you create 4 or more bad images then the later images can't load.


      /*
       * Main.fx
       *
       * Created on May 21, 2009, 2:07:12 PM
       */

      package test;

      import javafx.stage.Stage;
      import javafx.scene.Scene;
      import javafx.scene.*;
      import javafx.scene.shape.*;
      import javafx.scene.paint.*;
      import javafx.scene.image.*;

      /**
       * @author josh
       */

      var nodes:Node[];

      for(n in [0..2]) {
          var i = Image {
              backgroundLoading: true
              width: 800
              height: 618
              preserveRatio: true
              smooth: true
              url: ""
          };
      }


      var n = 0;
      Stage {
          title: "Application title"
          width: 500
          height: 500
          scene: Scene {
              content: [
                  Rectangle { fill: Color.RED width: 200 height: 200
                  onMousePressed: function(e) {
                      insert Rectangle { width: 50 height: 50 translateX: n * 20 translateY: n*20 fill: Color.GREEN } into nodes;
                      insert ImageView {
                              translateX: n*20
                              translateY: n*20
                              image: Image {
                                  backgroundLoading: true
                                  width: 100
                                  height: 100
                                  url: "http://antwrp.gsfc.nasa.gov/image/0905/StarryNight-of-Brazil_LinesTafreshi.jpg"
                              };
                      } into nodes;
                      n++;
                  }

                  }
                  Group {
                      content: bind nodes
                  }
              ]
          }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kcr Kevin Rushforth
                Reporter:
                jmarinacsunw Joshua Marinacci (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: