Re: [AD] user-defined events

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Saturday 27 September 2008, Peter Wang wrote:
> On 2008-09-27, Elias Pschernig <elias.pschernig@xxxxxxxxxx> wrote:
> > No matter how many fields are added though, it never will be nice. How
> > well would using just a single void *data work instead?
> >
> > It would be allocated whenever an event is emitted - but would it be
> > clear to users where to free it? For example, what if the event is never
> > received, or what if to event queues are receiving the events?
> >
> > I think we should make sure the above works, if it does not right now.
> > It's the only way I can see this useful - if necessary, we might have to
> > provide a callback pointer with a "cleanup_user_event" method which is
> > passed the event when it goes out of servrice or something, so user code
> > can free the data poiner there. (But maybe that's already working..
> > didn't look too close yet and the example apparently just casts an int
> > to a pointer.)
>
> It doesn't have any support for freeing user data in user events.
>
> Not sure what to do about it.

Little more serious this time, since your new event code will copy events 
everywhere, shouldn't the user free the event data once they are done with it? 
Just have to make sure the event queue still doesn't have a handle on it 
before that. 

> Peter
>

-- 
Thomas Fjellstrom
tfjellstrom@xxxxxxxxxx




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/