[EMAIL PROTECTED] schreef:
> For sound crash on double quit (not always crash), the problems is 
> that psObj is destoryed before the sound code get chance to 
> play/remove it.
> So psObj is pointing to nothing, but psSimpleObj->type (which is 
> psObj) points to area of memory that has been freed.  It then crash.
>
> How to fix this?  We have to make sure sound is removed before 
> psObj is out of scope.  
>
> Anyone know where psObj is killed off?  I know there is no 
> free(psObj) that would be too easy to find. ;)
>   
psObj is some kind of droid; psObj is never used by the sound code
itself, instead it is passed to a callback function.

I think that the best/easiest solution would be to simply drop the
callback support. All it currently does is calling a given function with
that psObj pointer upon finishing of playback from one sound effect.
> Devurandom in rev 1101, in heap.c, you change FREE & MALLOC to free 
> & malloc, but you no set what is free to NULL.  You also do not set 
> malloc memory to 0.  This could be cause of more errors, since lots 
> code expect this.
> This my understanding of what FREE & MALLOC macro did before.
>   
Actually this probably _will_ be the cause of errors (as devurandom
pointed out when he changed that). The fix however is _not_ to revert
back to previous behaviour. Since depending on malloc calls to return
zero-initialized memory, or free calls to set the pointer to NULL is
very, very bad programming style.

-- 
Giel

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev

Reply via email to