UTIL_Remove does exactly what you say.  It removes the entity on the
beginning of the next frame.  It adds it to a list of things to
delete, and that list is checked at a certain point of the frame when
everything is supposed to be done with it.  UTIL_RemoveImmediate is
the bad one.  It doesn't wait at all.  It deletes the entity right
there which leaves the possibility that other stuff still needs it
while the frame is still being calculated.

On Mon, Dec 22, 2008 at 9:05 PM, Michael Chang <[email protected]> wrote:
> I've had something similar happen once, although not directly associated
> with ragdolls.
>
> If I had to guess, it's something to do with using UTIL_Remove in an unsafe
> location in code, possibly during the an object's post-frame where something
> might be expected of an object after which it has been supposedly removed
> cleanly. To this day I haven't found the right answer yet, but I've had some
> success in preventing UTIL_Remove crashes by setting my own "deleteMe" flag,
> then running UTIL_Remove on the beggining of the next think or pre-think
> iteration.
>
> It's just a shot in the dark, but I hope that may be something to go on.
>
> ~M
>
>
> While working on my current mod (Smashball - www.smashball.tv), I came
>> across a rare server crash in physics.cpp: line 454 (int
>> CCollisionEvent::ShouldCollide function).  This function tries to
>> determine if two entities should collide.  The physics system has the
>> physics objects for each object along with a pointer to the
>> CBaseEntity that owns the physics objects.  Once-in-awhile this
>> function would crash the server, and it appeared that one of the
>> CBaseEntity pointers was dangling/no longer pointing to a valid
>> CBaseEntity.  I was watching the server console when one of these
>> crashes occurred, and the last line indicated a player had
>> disconnected.  I didn't plan on trying to track down the reason soon
>> due to the rarity of the crash, but tonight, I think I may have found
>> the source of the crash.  In hl2mp_player.cpp, the "UpdateOnRemove"
>> function calls "UTIL_RemoveImmediate( m_hRagdoll )" to immediately
>> delete the player's ragdoll.  Is this safe to do?  I suppose normally
>> the ragdoll doesn't have an associated physics entity on the server,
>> but in Smashball, players do have server ragdolls to sync up the
>> player's position with their ragdoll when they get up from being
>> knocked out.  I'm thinking that UTIL_RemoveImmediate deletes the
>> ragdoll entity immediately, but the physics object is left around with
>> the pointer to the entity until the end of the frame.  Is that
>> possible?
>>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives, please 
> visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to