| 08-21-2006, 09:13 AM | #1 |
I was just wondering if it is safe to destroy a handle to which other values are linked. Example: JASS:local trigger t = CreateTrigger() call SetHandleReal(t, "value", 1.00) call DestroyTrigger(t) set t = null Will this leak for example because I didn't flush the trigger, or it is enough to destroy it so that all linked values are broken? ~Daelin |
| 08-21-2006, 09:25 AM | #2 |
You cannot link anything to handle. Inside cache Handle ID stored as string and not monitored by game engine. Next trigger will take empty ID and all "linked" data. Using this exploit you can create auto cleaner functions. Just link some boolean value to handle for monitor its type and usage. |
| 08-21-2006, 01:00 PM | #3 | |
Quote:
JASS:call StoreReal(game_cache(), I2S(HANDLE_INTEGER)), name, value) |
| 08-21-2006, 01:25 PM | #4 |
You should alwasy clear attached variables before destroying the handle. |
| 08-21-2006, 01:46 PM | #5 |
Using direct arrays much more easy and faster. I dont know why all using cache... |
| 08-21-2006, 02:00 PM | #6 |
the value will be stored in the cache ofc "leaking", but why do you need to store a value and then destroy the trigger? :o |
| 08-21-2006, 02:01 PM | #7 | |
Quote:
JASS:call GetStoredInteger(GetUnitName(UNIT_1),"Skill") |
| 08-21-2006, 03:10 PM | #8 | |
Quote:
I am making a custom TriggerRegisterUnitEvent (you'll see pretty soon what) and I wanted to avoid using a custom DestroyTrigger() for it, to avoid confusions. Hmm... I guess I'll have to find a way to solve that. Thanks for the tips guys. It's just the answer I expected, dunno why I even thought that destroying the handle would solve the problem! :) ~Daelin |
| 08-21-2006, 04:31 PM | #9 |
direct arrays are static. cache is dynamic, there is no better reason. UnMi : He meant that arrays are faster in game than gamecache. Daelin, your answer is that you should always make sure to flush everything related to a handle before destroying the handle Else the screen will explode in your face. |
