On 6/26/07, Per Inge Mathisen <[EMAIL PROTECTED]> wrote:
On 6/26/07, Dennis Schridde <[EMAIL PROTECTED]> wrote: > Am Dienstag, 26. Juni 2007 schrieb The Watermelon: > > There is a dangling pointer problem after a game object is > > destroyed/deleted in objmem.c,I think per has a reference count patch for > > that,but it's a bit complex,maybe the problem can be solved by simply > > delaying the destruction of the object by 1 game frame,so every object who > > has reference to it will 'see' its 'died' mark and remove the reference to > > it.(never looked at objmem.c extensively though,not sure if there is any > > mechanics to do this already) > As I understood it exactly that is done already, just some patches of us > didn't pay respect to it. Yes, that is the design behind it. See the explanation page I made for the memory management code in the wiki. So there is some code somewhere that does not recheck its object reference each game frame. - Per
After messing with it a bit with MSVC,I am still unable to find the cause of the dangling pointer,seems it totally ignored the 'died' checks for 'psDest' in projectile update functions,for some unknown reason the killed droids during projectile update is freed immediately instead of waiting for gametime to update to free the objects/droids,you can make a copy of 'if (psObj->psDest && psObj->psDest->died)' checks at the beginning of projectile_update function,then copy it at the end of the same function(after the switch),and it should crash immediately as soon as an object shoots a projectile. Anyways,there is some hacky patch to replace your assert macro in header(which may potentially screw up the output of callstack in MSVC when assert happens) with inline debug function to make debugging with 'break point' easily in IDEs like MSVC.Just add some breakpoints to 'debug(LOG_ERROR)' lines in the new functions I added,then it should produce better callstack and more descriptive bug 'flags' when bad things happen within IDE. Hope this help.
breakablemacros.patch
Description: Binary data
_______________________________________________ Warzone-dev mailing list [email protected] https://mail.gna.org/listinfo/warzone-dev
