Bug 90

Summary: Two JInternalFrames with Animators crash with EXCEPTION_ACCESS_VIOLATION
Product: [JogAmp] Jogl Reporter: Sven Gothel <sgothel>
Component: coreAssignee: Sven Gothel <sgothel>
Status: VERIFIED WORKSFORME    
Severity: normal    
Priority: P1    
Version: 1   
Hardware: All   
OS: windows   
Type: DEFECT SCM Refs:
Workaround: ---

Description Sven Gothel 2010-03-24 07:46:40 CET


---- Reported by nikojn 2004-05-29 03:26:53 ----

Two JInternalFrames are added to a JDesktopPane. Both of them have GLCanvases 
controlled by Animators. Moving one of the windows on the desktop causes a non-
recoverable error, a crash with the following trace:

net.java.games.jogl.GLException: Error swapping buffers
        at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.swapBuffers
(WindowsOnscreenGLContext.java:140)
        at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:270)
        at net.java.games.jogl.GLCanvas.displayImpl(GLCanvas.java:186)
        at net.java.games.jogl.GLCanvas.display(GLCanvas.java:74)
        at net.java.games.jogl.Animator$1.run(Animator.java:104)
        at java.lang.Thread.run(Thread.java:534)

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at 
PC=0x693F21F6
Function=[Unknown.]
Library=G:\windows\System32\atioglxx.dll

NOTE: We are unable to locate the function name symbol for the error
      just occurred. Please refer to release documentation for possible
      reason and solutions.


Current Java thread:
        at 
net.java.games.jogl.impl.windows.WindowsGLImpl.dispatch_wglChoosePixelFormatARB
(Native Method)
        at 
net.java.games.jogl.impl.windows.WindowsGLImpl.wglChoosePixelFormatARB
(WindowsGLImpl.java:33092)
        at 
net.java.games.jogl.impl.windows.WindowsGLContext.choosePixelFormatAndCreateCont
ext(WindowsGLContext.java:342



The environment is:

- JOGL nightly build dated 20040517
- WinXP
- ATI Radeon 9700 Pro, with 4.5 Catalyst drivers
- J2SE 1.4.2_04

Note: this issue probably somewhat overlaps with the existing issue #30.
Here is the complete source code for the test case:

--- snip ---
import net.java.games.jogl.*;

import javax.swing.*;


public class GLCanvasTest
    implements GLEventListener
{
    public static void main(String[] args)
    {
        new GLCanvasTest().test();
    }

    public GLCanvasTest()
    {
    }

    public void test()
    {
        JFrame jFrame = new JFrame("Main Window");
        jFrame.setSize(640, 480);
        jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JDesktopPane jDesktopPane = new JDesktopPane();
        createChildWindow(jDesktopPane, "Child Window #1");
        createChildWindow(jDesktopPane, "Child Window #2");
        jFrame.setContentPane(jDesktopPane);
        jFrame.show();
    }

    private JInternalFrame createChildWindow(JDesktopPane jDesktopPane, final 
String title)
    {
        final JInternalFrame jInternalFrame = new JInternalFrame(title, true, 
true, true, true);
        jInternalFrame.setSize(320, 200);
        jInternalFrame.setLocation(jDesktopPane.getAllFrames().length * 200, 
jDesktopPane.getAllFrames().length * 200);

        GLCapabilities glCaps = new GLCapabilities();
        glCaps.setDoubleBuffered(true);
        glCaps.setHardwareAccelerated(true);
        GLCapabilitiesChooser glCapsChooser = new DefaultGLCapabilitiesChooser
();

        GLCanvas glCanvas = GLDrawableFactory.getFactory().createGLCanvas
(glCaps, glCapsChooser);
        glCanvas.addGLEventListener(this);

        jInternalFrame.getContentPane().add(glCanvas);
        jInternalFrame.show();
        jDesktopPane.add(jInternalFrame);

        final Animator animator = new Animator(glCanvas);
        new Thread()
        {
            public void run()
            {
                try
                {
                    sleep(1000);
                }
                catch (InterruptedException ignored)
                {
                }
                animator.start();
                jInternalFrame.setTitle(title + ", started");
            }
        }.start();

        return jInternalFrame;
    }

    public void init(GLDrawable glDrawable)
    {
    }

    public void display(GLDrawable glDrawable)
    {
        GL gl = glDrawable.getGL();
        gl.glClearColor((System.currentTimeMillis() % 1000) / 1000.0f, 0.0f, 
0.0f, 0.0f);
        gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
    }

    public void reshape(GLDrawable glDrawable, int i, int i1, int i2, int i3)
    {
    }

    public void displayChanged(GLDrawable glDrawable, boolean b, boolean b1)
    {
    }
}
--- snip ---



---- Additional Comments From kbr 2005-01-31 09:46:08 ----

This problem is caused by bugs in ATI's OpenGL drivers. The test case works on
NVidia hardware. Bug fixes and additional workarounds have recently been checked
in to the single-threaded workaround designed for ATI hardware. The attached
test case works properly with the code in the CVS repository, which will be
introduced in JOGL 1.1 b08.




--- Bug imported by sgothel@jausoft.com 2010-03-24 07:46 EDT  ---

This bug was previously known as _bug_ 90 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=90

The original assignee of this bug does not have
   an account here. Reassigning to the default assignee
   for the component, sgothel@jausoft.com.
   Previous assignee was kbr.