View Single Post
ThatOneGuy
Veteran Member
Join Date: Jul 2012
Location: Oregon, USA
Old 12-23-2018 , 23:55   Re: Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]
Reply With Quote #280

Quote:
Originally Posted by Neuro Toxin View Post
Looks like a plugin is trying to access an object that is alreasy dusposed.

Can you provide the code in the Event_PlayerDeath event callback?
They PM'd me. I believe it may be an error on my end.

In Event_PlayerDeath (and round end for those still alive), I was combining stats from multiple dynamic objects held in an ArrayList, I was removing/disposing one each time they were combined. In doing so, I didnt have the .IsValid check and thought I was fine without it by tracking how many cells the array had, using the .Erase function (shifting it), and going in reverse order. Somewhere, my logic has a scenario the leads to an invalid object. My fix for now is the .IsValid check. Am waiting to hear back from the poster regarding whether or not the issue is resolved, but I dont believe the error involves dynamic.

To make it more confusing for me, I had a memory leak (now patched) in that I forgot to dispose the objects being removed from the arraylist when they were combined. I was only disposing dynamic objects on next round start. That said, it is strange that an object was already disposed if there was no disposing until after all the processing was done...Is there not multiple seconds between round end/start events (during which all processing should be complete, so all objects should have still been valid)? I suppose I should test that assumption. That said, assuming there is time between those events, I dont understand how any dynamic object being processed could be already disposed. I can send you my code if needed. The .inc file was auto-generated from your tool.

EDIT: .IsValid causes other errors. Plugin is now recoded without Dynamic and all errors are gone.
__________________

Last edited by ThatOneGuy; 12-25-2018 at 12:20.
ThatOneGuy is offline