Author: toad
Date: 2008-07-24 14:53:00 +0000 (Thu, 24 Jul 2008)
New Revision: 21368

Modified:
   branches/db4o/freenet/src/freenet/support/RandomGrabArray.java
Log:
Maybe fix "Sub-segment has RGA but isn't registered to it!".
Also some deactivation.

Modified: branches/db4o/freenet/src/freenet/support/RandomGrabArray.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/RandomGrabArray.java      
2008-07-24 12:47:14 UTC (rev 21367)
+++ branches/db4o/freenet/src/freenet/support/RandomGrabArray.java      
2008-07-24 14:53:00 UTC (rev 21368)
@@ -90,7 +90,10 @@
                                                                changedMe = 
true;
                                                                // We are doing 
compaction here. We don't need to swap with the end; we write valid ones to the 
target location.
                                                                reqs[i] = null;
+                                                               
RandomGrabArrayItem oldItem = item;
                                                                
item.setParentGrabArray(null, container);
+                                                               if(persistent)
+                                                                       
container.deactivate(oldItem, 1);
                                                                continue;
                                                        }
                                                        if(i != target) {
@@ -192,6 +195,8 @@
                                        if(logMINOR) Logger.minor(this, "Not 
returning because cancelled: "+ret);
                                        ret = null;
                                        // Will be removed in the do{} loop
+                                       // Need to tell it first.
+                                       oret.setParentGrabArray(this, null);
                                }
                                if(ret != null && excluding.exclude(ret, 
container, context)) {
                                        excluded++;


Reply via email to