commit-classpath
[Top][All Lists]
Advanced

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

[commit-cp] classpath ChangeLog gnu/java/awt/peer/gtk/GdkPi...


From: Mark Wielaard
Subject: [commit-cp] classpath ChangeLog gnu/java/awt/peer/gtk/GdkPi...
Date: Mon, 12 Jun 2006 08:51:16 +0000

CVSROOT:        /cvsroot/classpath
Module name:    classpath
Changes by:     Mark Wielaard <mark>    06/06/12 08:51:15

Modified files:
        .              : ChangeLog 
        gnu/java/awt/peer/gtk: GdkPixbufDecoder.java 

Log message:
               * gnu/java/awt/peer/gtk/GdkPixbufDecoder.java (streamImage):
               Notify data when completely done. Wait for worker thread to 
finish.
               Rethrow any pending exceptions.
               (exception): New field.
               (run): Store pending exception.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.7777&r2=1.7778
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java?cvsroot=classpath&r1=1.23&r2=1.24

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/classpath/classpath/ChangeLog,v
retrieving revision 1.7777
retrieving revision 1.7778
diff -u -b -r1.7777 -r1.7778
--- ChangeLog   12 Jun 2006 08:42:59 -0000      1.7777
+++ ChangeLog   12 Jun 2006 08:51:15 -0000      1.7778
@@ -1,3 +1,11 @@
+2006-06-12  Mark Wielaard  <address@hidden>
+
+       * gnu/java/awt/peer/gtk/GdkPixbufDecoder.java (streamImage):
+       Notify data when completely done. Wait for worker thread to finish.
+       Rethrow any pending exceptions.
+       (exception): New field.
+       (run): Store pending exception.
+
 2006-06-12  Andrew John Hughes  <address@hidden>
 
        * java/lang/management/ManagementPermission.java:

Index: gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- gnu/java/awt/peer/gtk/GdkPixbufDecoder.java 11 Jun 2006 22:02:14 -0000      
1.23
+++ gnu/java/awt/peer/gtk/GdkPixbufDecoder.java 12 Jun 2006 08:51:15 -0000      
1.24
@@ -526,7 +526,8 @@
           model = img.getColorModel();
         }
 
-      new Thread(this, "GdkPixbufWriter").start();
+      Thread workerThread = new Thread(this, "GdkPixbufWriter");
+      workerThread.start();
       processImageStarted(1);
       synchronized(pixbufLock)
        {
@@ -536,9 +537,27 @@
       synchronized(data)
         {
           data.add(DATADONE);
+          data.notifyAll();
+        }
+
+      while (workerThread.isAlive())
+        {
+         try
+           {
+             workerThread.join();
+           }
+         catch (InterruptedException ioe)
+           {
+             // Ignored.
         }
     }    
 
+      if (exception != null)
+       throw exception;
+
+      processImageComplete();
+    }    
+
     /**
      * Object marking end of data from native streamImage code.
      */
@@ -552,6 +571,12 @@
      */
     private ArrayList data = new ArrayList();
 
+    /**
+     * Holds any IOException thrown by the run method that needs
+     * to be rethrown by the write method.
+     */
+    private IOException exception;
+
     /** Callback for streamImage native code. **/
     private void write(byte[] bs)
     {
@@ -593,12 +618,13 @@
                     }
                   catch (IOException ioe)
                     {
-                      // Not much we can do now...
+                      // We are only interested in the first exception.
+                      if (exception == null)
+                        exception = ioe;
                     }
                 }
             }
         }
-      processImageComplete();
     }
   }
 




reply via email to

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