[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gambas-devel
Subject:    Re: [Gambas-devel] Undead enumerators?
From:       Tobias Boege <tobias () gambas-buch ! de>
Date:       2013-07-27 13:29:11
Message-ID: 20130727132911.GC515 () aurora
[Download RAW message or body]

On Sun, 21 Jul 2013, Beno?t Minisini wrote:
> Le 13/07/2013 10:56, Tobias Boege a ?crit :
> > Hi Benoit,
> >
> > I may have reported this earlier but now you can see it yourself and with a
> > bit more output.
> >
> > In gb.data I have to iterate over List.Current and all active enumerators
> > when the list structure changes, i.e. elements are added or removed, in
> > order to update their information.
> >
> > I use GB.BeginEnum(), .NextEnum(), .GetEnum() and .EndEnum() to do this
> > (it's the macros begin_all_references and end_all_references in c_list.c). I
> > have looked up the semantics in the code of the Collection class.
> >
> > However, the API doesn't give only active enumerators but seemingly all that
> > have existed up to this point.
> >
> > Compile gb.data (latest revision) like
> >
> > $ make clean; make "CPPFLAGS+=-DDEBUG_ENUMERATOR"
> >
> > and run the attached project. You'll notice the debugging output from the
> > List class and one undead enumerator appearing.
> >
> > Is this intended behaviour (because this API is not documented, I don't know
> > if it should only report active enumerators or dead ones, too, but it
> > doesn't make much sense to me)? It took me some time to realise that this
> > was the cause of some nasty double-frees in gb.data... I worked around this
> > by explicitly marking dead enumerators as invalid and skipping them later,
> > though, but maybe we could clear the situation up.
> >
> > Regards,
> > Tobi
> >
> 
> The API has been fixed in revision #5749. Stopped enumerators are not 
> returned anymore.
> 
> Moreover, in revision #5750, stopped enumerators are immediately freed 
> (before they were freed when the function returns or if the enumeration 
> is started again).
> 

I now finally tested and it's working now. Thanks. In a subsequent commit,
I will eventually kick the workaround stuff out.

Regards,
Tobi


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-devel mailing list
Gambas-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic