Bug 1259 - NativeWindowException on attempting to destroy a drawable with a current context
Summary: NativeWindowException on attempting to destroy a drawable with a current context
Status: UNCONFIRMED
Alias: None
Product: Jogl
Classification: JogAmp
Component: windows (show other bugs)
Version: 2.4.0
Hardware: pc_x86_64 windows
: P4 normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2015-10-30 16:59 CET by Mark Raynsford
Modified: 2015-10-31 11:48 CET (History)
0 users

See Also:
Type: DEFECT
SCM Refs:
Workaround: ---


Attachments
Bug case (951 bytes, text/x-java)
2015-10-30 16:59 CET, Mark Raynsford
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Raynsford 2015-10-30 16:59:21 CET
Created attachment 763 [details]
Bug case

The following program will trigger a NativeWindowException:

Exception in thread "main" com.jogamp.opengl.GLException: Caught NativeWindowException: didn't release surface Handle: GDISurface[ displayHandle 0x0
, surfaceHandle 0x3c010834
, size 640x480
, UOB[ WINDOW_INVISIBLE ]
, WindowsWGLGraphicsConfiguration[DefaultGraphicsScreen[WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[obj 0x57566b8f]], idx 0], pfdID 2, ARB-Choosen true,
	requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL3/GL3.hw], offscr[fbo]],
	chosen    GLCaps[wgl vid 2 arb: rgba 8/8/8/8, trans-rgba 0x0/0/0/0, accum-rgba 0/0/0/0, dp/st/ms 24/8/0, dbl, mono  , hw, GLProfile[GL3/GL3.hw], on-scr[.]]]
, surfaceLock <7a79be86, 34ce8af7>[count 1, qsz 0, owner <main>]
, GDIDummyUpstreamSurfaceHook[pixel 640x480]
, upstreamSurface false ] on thread main
	at com.jogamp.opengl.GLException.newGLException(GLException.java:76)
	at jogamp.opengl.GLAutoDrawableBase.destroyImplInLock(GLAutoDrawableBase.java:404)
	at com.jogamp.opengl.GLAutoDrawableDelegate.destroyImplInLock(GLAutoDrawableDelegate.java:185)
	at jogamp.opengl.GLAutoDrawableBase.defaultDestroy(GLAutoDrawableBase.java:345)
	at com.jogamp.opengl.GLAutoDrawableDelegate.destroy(GLAutoDrawableDelegate.java:180)
	at com.io7m.scontext.CreateUnsharedContext0.main(CreateUnsharedContext0.java:26)
Caused by: com.jogamp.nativewindow.NativeWindowException: didn't release surface Handle: GDISurface[ displayHandle 0x0
, surfaceHandle 0x3c010834
, size 640x480
, UOB[ WINDOW_INVISIBLE ]
, WindowsWGLGraphicsConfiguration[DefaultGraphicsScreen[WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[obj 0x57566b8f]], idx 0], pfdID 2, ARB-Choosen true,
	requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL3/GL3.hw], offscr[fbo]],
	chosen    GLCaps[wgl vid 2 arb: rgba 8/8/8/8, trans-rgba 0x0/0/0/0, accum-rgba 0/0/0/0, dp/st/ms 24/8/0, dbl, mono  , hw, GLProfile[GL3/GL3.hw], on-scr[.]]]
, surfaceLock <7a79be86, 34ce8af7>[count 1, qsz 0, owner <main>]
, GDIDummyUpstreamSurfaceHook[pixel 640x480]
, upstreamSurface false ]
	at jogamp.nativewindow.windows.GDISurface.invalidateImpl(GDISurface.java:70)
	at jogamp.nativewindow.ProxySurfaceImpl.destroyNotify(ProxySurfaceImpl.java:115)
	at jogamp.opengl.GLDrawableImpl.setRealized(GLDrawableImpl.java:206)
	at jogamp.opengl.GLAutoDrawableBase.destroyImplInLock(GLAutoDrawableBase.java:385)

Calling release() on the drawable's context just prior to calling destroy() will work around the issue.

Platform is Windows 7 x86_64. AMD Catalyst 13.9. The drivers are the latest that are available, but could be charitably referred to as "elderly".
Comment 1 Mark Raynsford 2015-10-30 17:00:31 CET
This was against JOGL 2.3.1.
Comment 2 Mark Raynsford 2015-10-31 11:48:02 CET
I am prepared to believe that this is a documentation issue; I'm guessing there's behaviour that is allowed on some platforms and not others. The behaviour is consistent: It's not possible to destroy a drawable that is referenced in some manner, either by having a current context or being shared with something that has a current context.