JOGL SWT GLCanvas leaks SWT Color

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

JOGL SWT GLCanvas leaks SWT Color

badjames
Hi,

When running my application using the SWT "S-Leak" utility, it shows there is a leak of an SWT Color resource when the SWT GLCanvas is created:

java.lang.Error
        at org.eclipse.swt.graphics.Device.new_Object(Device.java:854)
        at org.eclipse.swt.graphics.Resource.init(Resource.java:89)
        at org.eclipse.swt.graphics.Color.<init>(Color.java:89)
        at com.jogamp.opengl.swt.GLCanvas.<init>(GLCanvas.java:385)

Looking at the source code at that line, it seems to verify this:

com/jogamp/opengl/swt/GLCanvas.java:

383:      // Bug 1362 fix or workaround: Seems SWT/GTK3 at least performs lazy initialization
384:      // Minimal action required: setBackground of the parent canvas before reparenting!
385:      setBackground(new Color(parent.getDisplay(), 255, 255, 255));

At line 385, the color is allocated and the reference is lost.  SWT does not take ownership of resources when passed into functions such as setBackground - it is the responsibility of the caller to release the resource when no longer needed.

This was using the latest 2.5.0 build.

Thanks!

James
Reply | Threaded
Open this post in threaded view
|

Re: JOGL SWT GLCanvas leaks SWT Color

gouessej
Administrator
Please create a bug report to avoid losing your precious analysis.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL SWT GLCanvas leaks SWT Color

badjames
This post was updated on .
Hi,

I've created debug and test logs via the relevant batch files.  I don't really feel comfortable uploading them here publicly, so I'd like to use the bug system.  However, I can't see how to create an account on:

https://jogamp.org/bugzilla/

Cheers,

James