Sorry for the delay. I briefly read then forgot about this email.

I'm OK with this patch going in as is, since I cannot (at least offhand)
think of a better way than doing the cast. I suppose could add an empty
"freeSDResources" method to the SurfaceData class and have the XRSurfaceData
be the only one that does anything with it but its really just window dressing.

PS: Is there some java-side equivalent in SurfaceData for X11SD_Dispose?
I have a GC on the java side with no references on the native side and
if possible would like to free it at dispose time without writing C
code.

I don't see how you free any X11 XID without dropping into native somewhere
but are you looking for something like the existing static method
XlibWrapper.XFreeGC(long display, long gc)" ?


-phil.


On 9/24/2010 2:55 PM, Clemens Eisserer wrote:
Hi Phil,


It doesn't sound right to me that this behaviour is an implementation detail of 
X.org.
Developers need to know that either it does or it doesn't. Were you given a
good rationale?
The explanation was that Pixmaps are reference counted, and therefor
stay alive if a XRender-picture points to it. A window is not
reference counted, and therefor all its resources are destroyed
immediatly. GC's are not affected because they are not bound to a
drawable, thats why it hasn't been a problem for the JDK to free GCs
later than the Window.
I find this explanation fishy, but the general recommendation was to
free Pictures before the drawable in any case.

The patch attached does free the picture before destroying the window,
however casting surfaceData to XRSurfaceData in XWindow.java is ugly -
and the patch assumes nobody calls XDestroyWindow for a
SurfaceData-Drawable except destroy(). Suggestions welcome ;)

With that patch I get rid of all XErrors and also can't reproduce the
XDnD-Exception anymore.

I don't see how that helped on its own. If the Picture is implicitly freed
by XDestroyWindow then
xsdo->xrPic is still going to be != None .. or am I overlooking something?
My initial analysis was wrong - somehow I thought the problem is
solved, but it wasn't.

Thanks Clemens

PS: Is there some java-side equivalent in SurfaceData for X11SD_Dispose?
I have a GC on the java side with no references on the native side and
if possible would like to free it at dispose time without writing C
code.

Reply via email to