Java Applet That Uses Frame.setFrameIcon Causes an Invalid Page Fault in User.exe (294692)



The information in this article applies to:

  • Microsoft Windows Millennium Edition
  • Microsoft Windows 98 Second Edition
  • Microsoft Windows 98
  • Microsoft Visual J++ 6.0

This article was previously published under Q294692

SYMPTOMS

When you develop or use a Java applet that uses the AWT Frame.setFrameIcon method on the same icon on multiple frames, you may receive the following error message:
IEXPLORE caused a general protection fault
in module USER.EXE at 0003:0000a3e

CAUSE

When you implement Frame.setIconImage, it assumes that it owns the image associated with the frame. On each call to setIconImage, the native code frees a handle to an icon and creates a new one. As a result, Windows tries to free an icon two times and the computer does not work as expected.

RESOLUTION

To work around this behavior, do not set a frame object's icon more than one time and do not use an image object instance to set the icon of more than one frame. For example, if your program uses ImageLoader's getImage method to load an icon image into a global variable, make a copy of the image before you set the image on each frame:
img = Loader.getImage("APPICON.GIF");
Image img1 = img.getScaledInstance (-1, -1, Image.SCALE_DEFAULT);
((Frame)(this.getDecorator())).setIconImage(img1);
				

STATUS

This behavior is by design.

Modification Type:MinorLast Reviewed:12/17/2004
Keywords:kbprb kbQFE KB294692