| 06-05-2006, 10:35 PM | #1 | |
I never knew this before. Maybe somebody else do, but I am posting it anyways, to all the guys who do not know it. ____ Destroying a trigger that is currently running using DestroyTrigger does not stop it from finishing executing. But removing the triggeractions stops it instantly. See attached demo map.
|
| 06-06-2006, 02:36 PM | #2 |
yes, I demonstrated this in my cinskipmadeEasy map. I'm right now exploring condition functions can they use waits? |
| 06-06-2006, 02:41 PM | #3 |
I swear I knew this already and reported it to either wc3jass.com or this site. I considered it an annoyance cause it can't be practical sicne you can't recognize it in the trigger that is being stopped, so if you had any handle variables or objects you wanted to destroy they'll leak and all that kind of problems. BTW: A trigger can have multiple actions |
| 06-06-2006, 04:48 PM | #4 |
Wait a minute.. does this mean you cannot fully clean up the action inside the action itself? Since removing the action will.. stop the action, which means the variable cannot be set to null? Only way out I see is return bug.. |
| 06-06-2006, 06:09 PM | #5 |
You can't clean stuff up in the end of the thread, as it stops instantly. I considered it an annoyance too when I found out about it, but I can think of a couple of situations now where it could be useful. |
| 06-06-2006, 06:52 PM | #6 |
So, for cleaning up a trigger (for example a dynamicaly created trigger that destroys itself once executed), you must first start a seperate thread with ExecuteFunc and then clean up your trigger from there? Edit: has it been confirmed that trigger actions leak if they're not destroyed seperately from the trigger? I remember Vex once stating that he removes triggeractions just as a precaution, and that he wasn't sure if it leaked at all and if perhaps DestroyTrigger was enough... |
| 06-06-2006, 07:18 PM | #7 |
If you are going to remove the triggeraction from inside the action function, then no cleanup after that will take place, so another thread is best there. I have not tested it, but triggeractions are new objects created everytime, it would be very weird if they did not leak, like other dynamically created objects. |
| 06-07-2006, 12:38 AM | #8 |
Yes, triggeractions require triggerremoveaction for deallocation. This explains why it appeared impossible to make triggers with out leaking.. really good to know. |
| 06-07-2006, 12:44 AM | #9 |
back then I wasn't sure if TriggerRemoveAction was enough I knew that I had to clean the actions but wadn't sure if that's the fix for all leaks when creating triggers. Right now it seems to work quite well. |
