• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

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

Status
Not open for further replies.
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.
 
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.
Back
Top