JDK-4926453 : NPE in Win32SurfaceData while running applet demos with Tiger b08
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2003-09-23
  • Updated: 2006-06-06
  • Resolved: 2006-06-06
Related Reports
Relates :  
Description
While running the applet demos one after another with jdkx on windows. I occasionally get the following Exception :

Y:/jdk1.5.0/windows-i586/bin/java sun.applet.AppletViewer file:Y:/jdk1.5.0/win
ws-i586/demo/applets/SortDemo/example1.html
java.lang.NullPointerException: component argument pData
        at sun.awt.windows.Win32SurfaceData.initOps(Native Method)
        at sun.awt.windows.Win32SurfaceData.<init>(Win32SurfaceData.java:439)
        at sun.awt.windows.Win32SurfaceData.createData(Win32SurfaceData.java:3
)
        at sun.awt.windows.WComponentPeer.replaceSurfaceData(WComponentPeer.ja
:307)
        at sun.awt.windows.WComponentPeer$2.run(WComponentPeer.java:320)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:188)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:459)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatch
read.java:214)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchTh
ad.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:15

        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:14

        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)


###@###.### 2003-09-22

Note: the exception occurs upon exiting an applet by clicking the close box on the Window.
###@###.### 2003-10-13

Comments
EVALUATION This started occuring in 1.5 b08. The first time I saw this in the j2d nightly builds was in the May 27 PIT build and the May 28 nightly build. Given the amount of files updated for those builds, it is difficult to see the culprit, but it's not clear that this is a 2D issue. Instead, the actual problem comes from requesting the pData from the Component; since the window has already gone away, there is no pData, so the exception is thrown. It seems like this might be caused by some change in the ordering of Awt shutdown. More investigation necessary. ###@###.### 2003-10-13 Aha! There was an AWT fix that changed the ordering of AWT disposal; there used to be a call to SendMessage(WM_AWT_DISPOSE), and now there is a call to PostMessage instead. (The call used to be in awt_Component.cpp, but is now in awt_Object.cpp). When I revert Post back to Send, this bug is fixed. I suspect that, due to the asynchronous nature of PostMessage, some parts of the system do not yet know that other parts have been destoryed. So a call goes through to recreate the window's SurfaceData object that otherwise would not, and the subsequent call to get the pData from the Component fails because that component no longer exists. See bug 4821397 for more information on the Send/Post fix; that bug fix was one of the Awt fixes that went into b08 (when this probelm first occurred). Forwarding to the AWT group for evaluation. ###@###.### 2003-10-13 Name: ssR10077 Date: 11/17/2003 Can't reproduce the bug but looks like a duplicate of 4917176 ====================================================================== I can still reproduce it in b28 (latest build) To reproduce it you need to open and close the applet repeatedly in a loop. It will happen every 5th time or so. Below is a little korn shell script to do this. # save this file as loop COUNTER=0 while [ $COUNTER -lt $1 ]; do $2 $3 $4 $5 $6 $7 let COUNTER=COUNTER+1 done Save the above snippet as a file called loop. Then run it as follows in ksh : loop /usr/java/j2sdk1.5.0/bin/appletviewer 20 example1.html When tha applet frame comes up close the frame immediately. Repeat this until you see the exception. ###@###.### 2003-11-17
17-11-2003