[cp-patches] RFC: deadlock with Componet/CairoGraphics.drawImage()
mark at klomp.org
Sat Jun 10 21:17:06 UTC 2006
I was seeing deadlocks in some cases with ComponentGraphics.drawImage().
ComponentGraphics takes the gdk lock and then calls super.drawImage().
But in some cases when the image isn't a BufferedImage CairoGraphics
would recurse into drawImage() again. And since the gdk lock isn't
reentrant that would cause a deadlock. There was a second problem if the
image was the error image, in that case it wouldn't have a ImageProducer
and later on in CairoGraphics.drawImage() an Exception would be thrown.
In that case the gdk lock would never be released. To prevent against
such situations this patch also moves all operations that have to
operate with the gdk lock held into a try-finally block to make sure the
lock is always released.
2006-06-10 Mark Wielaard <mark at klomp.org>
* gnu/java/awt/peer/gtk/CairoGraphics2D.java (drawImage):
Don't recurse, return false if not an BufferedImage and no image
* gnu/java/awt/peer/gtk/ComponentGraphics.java (draw): Add
end_gdk_drawing() to finally block.
Does this look sane?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3217 bytes
Desc: not available
Url : http://developer.classpath.org/pipermail/classpath-patches/attachments/20060610/df34465c/gdk-deadlock.bin
More information about the Classpath-patches