svn commit: r15955 - trunk/src/argouml-app/src/org/argouml/cognitive/ToDoList.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2008-11-02 05:32:51-0700
New Revision: 15955

Modified:
   trunk/src/argouml-app/src/org/argouml/cognitive/ToDoList.java

Log:
Issue 5420: Make sure removeitem event is given an immutable list of todo items

Modified: trunk/src/argouml-app/src/org/argouml/cognitive/ToDoList.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/cognitive/ToDoList.java?view=diff&rev=15955&p1=trunk/src/argouml-app/src/org/argouml/cognitive/ToDoList.java&p2=trunk/src/argouml-app/src/org/argouml/cognitive/ToDoList.java&r1=15954&r2=15955
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/cognitive/ToDoList.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/cognitive/ToDoList.java	2008-11-02 05:32:51-0700
@@ -246,7 +246,7 @@
             }
             recomputeAllOffenders();
             recomputeAllPosters();
-            fireToDoItemsRemoved(removes);
+            fireToDoItemsRemoved(Collections.unmodifiableList(removes));
         }
     }
 
@@ -798,6 +798,7 @@
      * @param theItems the todo items
      */
     protected void fireToDoItemsRemoved(List<ToDoItem> theItems) {
+        List<ToDoItem> toDoItems = null;
         // Guaranteed to return a non-null array
         Object[] listeners = listenerList.getListenerList();
         ToDoListEvent e = null;
@@ -807,7 +808,8 @@
             if (listeners[i] == ToDoListListener.class) {
                 // Lazily create the event:
                 if (e == null) {
-                    e = new ToDoListEvent(theItems);
+                    toDoItems = Collections.unmodifiableList(theItems);
+                    e = new ToDoListEvent(toDoItems);
                 }
                 ((ToDoListListener) listeners[i + 1]).toDoItemsRemoved(e);
             }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.