classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: another MediaTracker fix


From: Roman Kennke
Subject: [cp-patches] FYI: another MediaTracker fix
Date: Wed, 13 Apr 2005 13:52:33 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204

Hi,

I found more problems with MediaTracker (this time some lockups) and fixed them. I also removed some unnessecary stuff.


2005-04-13  Roman Kennke  <address@hidden>

   * java/awt/MediaTracker.java
   (MediaEntry.imageUpdate): Removed check for SOMEBITS, this
   confused the media tracker and lead to lockups. The LOADING
   bit is handled on other places.
   (addImage): Removed the 'start image tracking' stuff. This
   is not necessary and could confuse the media tracker.
   (checkAll): Improved the check for image status so that
   images that already complete images are detected. Also now
   are really all images checked and if necessary loaded. Before
   the method bailed out after the first incomplete image.
   (statusAll): Detect images that are complete after the
   call to Component.prepareImage(..).
   (checkID): The same as in checkAll.
   (statusID): The same as in statusAll.


/Roman

Index: java/awt/MediaTracker.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/MediaTracker.java,v
retrieving revision 1.12
diff -u -r1.12 MediaTracker.java
--- java/awt/MediaTracker.java  12 Apr 2005 19:48:43 -0000      1.12
+++ java/awt/MediaTracker.java  13 Apr 2005 11:48:57 -0000
@@ -134,8 +134,6 @@
         status = ERRORED;
       else if ((flags & ALLBITS) != 0)
         status = COMPLETE;
-      else if ((flags & SOMEBITS) != 0)
-        status = LOADING;
       else
         status = 0;
 
@@ -176,9 +174,6 @@
         e.next = head;
         head = e;
       }
-    // Start tracking image status.
-    int flags = target.checkImage(image, e);
-    e.imageUpdate(image, flags, -1, -1, -1, -1);
   }
 
   /**
@@ -203,9 +198,6 @@
         e.next = head;
         head = e;
       }
-    // Start tracking image status.
-    int flags = target.checkImage(image, width, height, e);
-    e.imageUpdate(image, flags, -1, -1, width, height);
   }
 
   /**
@@ -245,21 +237,23 @@
     
     while (e != null)
       {
-       if ((e.status & (COMPLETE | ERRORED | ABORTED)) == 0)
-         {
-           if (load)
-             {
-               result = false;
-               if (e.status == 0)
-                 {
-                   target.prepareImage(e.image, e);
-                   e.status = LOADING;
-                 }
-             }
-           else
-             return false;
-         }
-       e = e.next;
+        if ((e.status & (COMPLETE | ERRORED | ABORTED)) == 0)
+          {
+            if (load && ((e.status & LOADING) == 0))
+              {
+                e.status = LOADING;
+                result = false;
+                boolean complete = target.prepareImage(e.image, e);
+                if (complete)
+                  {
+                    e.status = COMPLETE;
+                    result = true;
+                  }
+              }
+            else
+              result = false;
+          }
+        e = e.next;
       }
     return result;
   }
@@ -378,10 +372,13 @@
     while (e != null)
       {
         if (load && e.status == 0)
-         {
-           target.prepareImage(e.image, e);
-           e.status = LOADING;
-         }
+          {
+            boolean complete = target.prepareImage(e.image, e);
+            if (complete)
+              e.status = COMPLETE;
+            else
+              e.status = LOADING;
+          }
         result |= e.status;
        e = e.next;
       }
@@ -420,21 +417,23 @@
     
     while (e != null)
       {
-       if (e.id == id && ((e.status & (COMPLETE | ABORTED | ERRORED)) == 0))
-         {
-           if (load)
-             {
-               result = false;
-               if (e.status == 0)
-                 {
-                   target.prepareImage(e.image, e);
-                   e.status = LOADING;
-                 }
-             }
-           else
-             return false;
-         }
-       e = e.next;
+        if (e.id == id && ((e.status & (COMPLETE | ABORTED | ERRORED)) == 0))
+          {
+            if (load && ((e.status & LOADING) == 0))
+              {
+                e.status = LOADING;
+                result = false;
+                boolean complete = target.prepareImage(e.image, e);
+                if (complete)
+                  {
+                    e.status = COMPLETE;
+                    result = true;
+                  }
+              }
+            else
+              result = false;
+          }
+        e = e.next;
       }
     return result;
   }
@@ -567,10 +566,13 @@
         if (e.id == id)
          {
             if (load && e.status == 0)
-             {
-               target.prepareImage(e.image, e);
-               e.status = LOADING;
-             }
+              {
+                boolean complete = target.prepareImage(e.image, e);
+                if (complete)
+                  e.status = COMPLETE;
+                else
+                  e.status = LOADING;
+              }
             result |= e.status;
          }
        e = e.next;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]