JDK-4343270 : Toolkit.createCustomCursor() hangs the VM under Win NT
  • Type: Bug
  • Component: docs
  • Sub-Component: guides
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2000-06-05
  • Updated: 2002-05-01
  • Resolved: 2002-04-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.1 hopperFixed
Description

Name: dsR10051			Date: 06/05/2000



The method java.awt.Toolkit.createCustomCursor(Image cursor, Point hotSpot, String name)
hangs the VM under Windows NT if cursor is multi-frame image.

Here is a minimized test:

import java.io.*;
import java.awt.*;
import java.awt.image.*;

public class TestToolkit {
        public static void main(String[] args) {
            try {
                Toolkit tk = Toolkit.getDefaultToolkit();
                String file = "file:///" + args[0] + "/31kb.gif";
                System.out.println("File: " + file);
                Image im = tk.getImage(new java.net.URL(file));
                Canvas c = new Canvas();
                if(!tk.prepareImage(im, -1, -1, c)) {
                        while((tk.checkImage(im, -1, -1,c) &
                                (ImageObserver.FRAMEBITS |
                                ImageObserver.ALLBITS)) == 0) {
                            Thread.yield();
                        }
                }
                System.out.println(tk.checkImage(im, -1, -1,c));
                Point p = new Point(0,0);
                System.out.println("Custom cursor creating");
                Cursor cur = tk.createCustomCursor(im, p, "Test");
                System.out.println("Custom cursor is successfully created");

                
                System.exit(0);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
}

Multi-frame image "31kb.gif" is attached.

--- Output ---
F:\NightlyNT\BIN\Tests>f:\NightlyNT\java\jdk1.3\win32\bin\java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

F:\NightlyNT\BIN\Tests>f:\NightlyNT\java\jdk1.3\win32\bin\java -classpath . TestToolkit f:/NightlyNT/BIN/Tests
File: file:///f:/NightlyNT/BIN/Tests/31kb.gif
23
Custom cursor creating
^C

======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: generic hopper FIXED IN: hopper INTEGRATED IN: hopper
14-06-2004

PUBLIC COMMENTS .
10-06-2004

EVALUATION Commit to fix in Merlin (JCK failure, hang). eric.hawkes@eng 2000-06-13 This looks likes a problem with sun.awt.image.GifDecoder richard.ray@eng 2000-08-14 Looks like an AWT bug. In WCustomCursor, the code should not be reconstructing ImageObserver.ALLBITS, but rather, ImageObserver.FRAMEBITS, just in case there is a multi-frame image. jeannette.hung@Eng 2000-08-28 The fix for this bug caused a serious hang: 4369714. eric.hawkes@eng 2000-09-09 I have removed the fix and documentation for java.awt.Toolkit.createCustomCursor should be updated to indicated it does not work for multiframe images. richard.ray@eng 2000-09-12 Re-committing to Merlin. eric.hawkes@eng 2000-09-13 ---- Evaluation: Right, documentation for Toolkit.createCustomCursor should be updated to indicated it does not work for multiframe images. Also note that in case of multi-frame image this method just hangs up and this fact should be touched on somehow in documentation. Javadoc for JDK1.4.0beta-b75 says: public Cursor createCustomCursor(Image cursor, Point hotSpot, String name) throws IndexOutOfBoundsException, HeadlessException Creates a new custom cursor object. If the image to display is invalid, the cursor will be hidden (made completely transparent), and the hotspot will be set to (0, 0). Parameters: image - the image to display when the cursor is active. hotSpot - the X and Y of the large cursor's hot spot. The hotSpot values must be less than the Dimension returned by getBestCursorSize(). name - a localized description of the cursor, for Java Accessibility use. Throws: IndexOutOfBoundsException - if the hotSpot values are outside the bounds of the cursor. HeadlessException - if GraphicsEnvironment.isHeadless() returns true Since: 1.2 ###@###.### 2001-08-13 ---- Added a note to createCustomCursor. Fixed for hopper. ###@###.### 2002-03-15
13-08-2001