[gui] [PATCH] Fix to MediaTracker.imageUpdate()

David Jee djee@redhat.com
Thu Jun 10 18:49:00 GMT 2004


Hi,

I committed the following patch to the java-gui-branch.  It fixes a
deadlock problem that was caused by MediaTracker.imageUpdate().  In that
method, we only want to notify waiting threads if the image has finished
loading.  If we prematurely notify a waiting thread, deadlocks can
occur.  Specifically, in MediaTracker.waitForAll(), there is a wait()
inside a synchronized block which will not exit until the image has
finished loading.  Notifying this waiting thread before the image is
complete will cause a deadlock, because waitForAll() will block the
image loading thread from completing, and waitForAll() will not exit the
synchronized block until the image has finished loading.

-David Jee

2004-06-10  David Jee  <djee@redhat.com>

        * java/awt/MediaTracker.java
        (imageUpdate): Only do notifyAll() if the image is complete.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: MediaTracker.patch
Type: text/x-patch
Size: 750 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20040610/1e6da98b/attachment.bin>


More information about the Java-patches mailing list