deweese 2003/11/07 12:33:52 Modified: sources/org/apache/batik/bridge UpdateManager.java sources/org/apache/batik/swing/svg JSVGComponent.java sources/org/apache/batik/util DoublyLinkedList.java Log: Finally fixed the race condition in setSVGDocument. Revision Changes Path 1.30 +15 -14 xml-batik/sources/org/apache/batik/bridge/UpdateManager.java Index: UpdateManager.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/UpdateManager.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- UpdateManager.java 5 Nov 2003 22:21:10 -0000 1.29 +++ UpdateManager.java 7 Nov 2003 20:33:52 -0000 1.30 @@ -236,7 +236,7 @@ } } }); - updateRunnableQueue.resumeExecution(); + resume(); } @@ -312,23 +312,24 @@ * Interrupts the manager tasks. */ public synchronized void interrupt() { - if (updateRunnableQueue.getThread() != null) { - // Preempt to cancel the pending tasks - updateRunnableQueue.preemptLater(new Runnable() { - public void run() { + if (updateRunnableQueue.getThread() == null) + return; + + // Preempt to cancel the pending tasks + updateRunnableQueue.preemptLater(new Runnable() { + public void run() { + synchronized (UpdateManager.this) { if (started) { dispatchSVGUnLoadEvent(); } else { - synchronized (UpdateManager.this) { - running = false; - scriptingEnvironment.interrupt(); - updateRunnableQueue.getThread().interrupt(); - } + running = false; + scriptingEnvironment.interrupt(); + updateRunnableQueue.getThread().interrupt(); } } - }); - resume(); - } + } + }); + resume(); } /** 1.92 +11 -9 xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java Index: JSVGComponent.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java,v retrieving revision 1.91 retrieving revision 1.92 diff -u -r1.91 -r1.92 --- JSVGComponent.java 5 Nov 2003 22:21:10 -0000 1.91 +++ JSVGComponent.java 7 Nov 2003 20:33:52 -0000 1.92 @@ -473,18 +473,21 @@ if (documentLoader != null) { documentLoader.interrupt(); - } else if (gvtTreeBuilder != null) { + } + if (gvtTreeBuilder != null) { gvtTreeBuilder.interrupt(); - } else if (svgLoadEventDispatcher != null) { + } + if (svgLoadEventDispatcher != null) { svgLoadEventDispatcher.interrupt(); - } else if (nextUpdateManager != null) { + } + if (nextUpdateManager != null) { nextUpdateManager.interrupt(); nextUpdateManager = null; - } else if (updateManager != null) { + } + if (updateManager != null) { updateManager.interrupt(); - } else { - super.stopProcessing(); - } + } + super.stopProcessing(); } /** @@ -602,7 +605,6 @@ afterStopRunnable = r; return; } - afterStopRunnable = r; stopProcessing(); 1.5 +15 -7 xml-batik/sources/org/apache/batik/util/DoublyLinkedList.java Index: DoublyLinkedList.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/util/DoublyLinkedList.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- DoublyLinkedList.java 5 Nov 2003 22:21:10 -0000 1.4 +++ DoublyLinkedList.java 7 Nov 2003 20:33:52 -0000 1.5 @@ -150,14 +150,22 @@ public void add(int index, Node nde) { if (nde == null) return; - Node after = head; - while (index != 0) { - after = after.getNext(); - index--; + if (index == 0) { + // This makes it the first element in the list. + nde.insertBefore(head); + head = nde; + } else if (index == size) { + // Because the list is circular this + // makes it the last element in the list. + nde.insertBefore(head); + } else { + Node after = head; + while (index != 0) { + after = after.getNext(); + index--; + } + nde.insertBefore(after); } - nde.insertBefore(after); - if (after == head) - head=nde; size++; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]