| 09-15-2006, 12:35 PM | #1 |
I just have a few questions on leaks. The first one is if you use a native or a function that returns a handle and you dont save it in a variable but you use it in another function (i.e. GetLocationX/Y) does it still leak. Like in the following example JASS:set x = GetLocationX(GetSpellTargetLoc()) set y = GetLocationY(GetSpellTargetLoc()) will this leak and if it does it means you have to save the location as a variable like this JASS:set location point = GetSpellTargetLoc() set x = GetLocationX(point) set y = GetLocationY(point) call RemoveLocation(point) Also with cleaning up leaks when dealing with triggers, I heard that you need to use TriggerRemoveAction before destroying the Trigger by adding a wait in, is this true. i.e. if you have some function that is called by an action from a trigger JASS:function blah takes nothing returns nothing local trigger temp = GetTriggeringTrigger() //Some random script here call TriggerRemoveAction(temp,blah) call DestroyTrigger(temp) is this enough to destroy the leak. BTW I wrote this on the run so the syntax may not be fully correct |
| 09-15-2006, 12:38 PM | #2 | ||
Quote:
Yes, that will leak, you have to set the location in a variable, set the x/y and then remove the location using RemoveLocation. Quote:
There is a thread about the gamecache bug, which wasn't a gamecache bug, but rather a destroy trigger bug. With tests, we figured out that after using a wait time of at least 30 seconds, and then destroying a specified trigger, removes any weird bugs occuring with it and other handles. This is still in question because in my map, I dont get those problems, but then again, I use globals. So it seems this problem lies when using local triggers, and not global ones. |
