On Tuesday 10 February 2009 04:52, Daniel Cheng wrote: > On Tue, Feb 10, 2009 at 8:39 AM, Matthew Toseland > <[email protected]> wrote: > > On Thursday 05 February 2009 00:26, Daniel Cheng wrote: > >> On Thu, Feb 5, 2009 at 3:21 AM, <[email protected]> wrote: > >> > Author: toad > >> > Date: 2009-02-04 19:21:34 +0000 (Wed, 04 Feb 2009) > >> > New Revision: 25554 > >> > > >> > Modified: > >> > > > branches/db4o/freenet/src/freenet/client/async/SplitFileInserterSegment.java > >> > Log: > >> > Doh! Fix isEmpty > >> > > >> > > >> > Modified: > > branches/db4o/freenet/src/freenet/client/async/SplitFileInserterSegment.java > >> > =================================================================== > >> > --- > > branches/db4o/freenet/src/freenet/client/async/SplitFileInserterSegment.java > > 2009-02-04 19:10:02 UTC (rev 25553) > >> > +++ > > branches/db4o/freenet/src/freenet/client/async/SplitFileInserterSegment.java > > 2009-02-04 19:21:34 UTC (rev 25554) > >> > @@ -1355,6 +1355,9 @@ > >> > } > >> > > >> > public synchronized boolean isEmpty(ObjectContainer container) { > >> > - return (finished || blocks.isEmpty()); > >> > + if(persistent) container.activate(blocks, 2); > >> > + boolean ret = (finished || blocks.isEmpty()); > >> > + if(persistent) container.deactivate(blocks, 1); > >> > >> object deactivated as a side effect of isEmpty() ! > >> this is quite unexpected and may be very hard to debug later.. > > > > Eh? It's an internal object, we do that all the time. > > I am saying "it don't work", > I am saying "it is nasty to debug if we forget this some months later"
In some places we do check whether it was activated and only deactivate it if it was deactivated to begin with. HOWEVER in cases such as the above, with a method which is called externally, accessing an internal only variable, it is the only solution short of cascade-activating it. > >> > >> > + return ret; > >> > } > >> > }
pgpjKn1kXcdHP.pgp
Description: PGP signature
_______________________________________________ Devl mailing list [email protected] http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
