• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Is it always necessary to destroy triggers when no longer in use?

Status
Not open for further replies.
Level 12
Joined
May 22, 2015
Messages
1,051
Don't destroy GUI triggers as their actions will still leak and can corrupt the handle stack. If a trigger might run more than once, disable the trigger (Trigger - Turn off).

Triggers with only conditions attached are OK to destroy.

Is this only a problem if your GUI trigger leaks? What if you clean up all the leaks? What if you create a leak-free JASS trigger that still uses actions? I am just uncertain what causes this corruption and I am curious.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
Triggers with only conditions attached are OK to destroy.

A GUI trigger does not always have a condition, but will always have an action.
An empty GUI trigger (even without event) will have an action.

Also, you said it as if actions only use data if their trigger is destroyed...
Destrying a trigger without removing the actions properly is not bad, but it is better to also remove the actions.
 
SAUS said:
Is this only a problem if your GUI trigger leaks? What if you clean up all the leaks? What if you create a leak-free JASS trigger that still uses actions? I am just uncertain what causes this corruption and I am curious.

This is really obscure. You saying that the triggeraction object has its handle recycled while the object is not removed?

It is showcased here:
http://www.wc3c.net/showpost.php?p=999565&postcount=31

@Empirean: You can destroy them, but it really isn't necessary. The only times I would ever destroy a trigger is when I'm creating them periodically or dynamically. But in GUI that isn't too common, so I wouldn't worry about it.
 
Status
Not open for further replies.
Top