Author: toad
Date: 2009-01-30 18:52:31 +0000 (Fri, 30 Jan 2009)
New Revision: 25408

Modified:
   branches/db4o/freenet/src/freenet/client/async/SingleBlockInserter.java
Log:
Fix an activation NPE from saces


Modified: 
branches/db4o/freenet/src/freenet/client/async/SingleBlockInserter.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SingleBlockInserter.java     
2009-01-30 18:38:35 UTC (rev 25407)
+++ branches/db4o/freenet/src/freenet/client/async/SingleBlockInserter.java     
2009-01-30 18:52:31 UTC (rev 25408)
@@ -274,8 +274,12 @@
                        }
                }
                if(getCHKOnly) {
-                       if(persistent)
-                               container.activate(cb, 1);
+                       boolean deactivateCB = false;
+                       if(persistent) {
+                               deactivateCB = !container.ext().isActive(cb);
+                               if(deactivateCB)
+                                       container.activate(cb, 1);
+                       }
                        ClientKeyBlock block = encode(container, context, true);
                        cb.onEncode(block.getClientKey(), this, container, 
context);
                        parent.completedBlock(false, container, context);
@@ -283,7 +287,8 @@
                        finished = true;
                        if(persistent) {
                                container.store(this);
-                               container.deactivate(cb, 1);
+                               if(deactivateCB)
+                                       container.deactivate(cb, 1);
                        }
                } else {
                        getScheduler(context).registerInsert(this, persistent, 
true, true, container);

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to