Game Development Community

Who deleted posted NetEvents after send?

by Anthony Lovell · in Torque Game Engine · 02/26/2007 (7:15 am) · 1 replies

I do not see that my dynamically newed-up NetEvents ever get deleted after they make it out the wire. What is the intended lifecycle for these?

edit: I guess I am going to try adding

void MyEvent::notifyPosted(EventConnection *) { incRef(); }
void MyEvent::notifySent(EventConnection *) { decRef(); }

are there other such overrides I should be trying (for unguaranteed events)?

I would *really* like to see TNL make use of the RefCounting on these so I can rest assured that I can wash my hands of any event I post, and rely on TNL honoring any incRef()s I might employ on processEvent(). I am making these enhancements in my own code.

tone

#1
07/07/2007 (9:40 pm)
I'm sure you've already solved this on your own. I ran into the same issue a while back. TNL really needs a more transparent memory model in this respect. The NetEvent is deleted when TNL decides the object is "no longer needed", e.g. it got acked, got dropped, or got sent as an unguaranteed event. Even though it inherits from Object, the NetEvent is NOT ref counted in TNL. TNL assumes it owns the object.

This is not helpful to me if I want to queue up events to fire them at my choosing. I ended up writing up a parallel events hierarchy, with NetEvent used as a transport only.