HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Destruct COndition while in use

10-06-2006, 07:43 PM#1
BertTheJasser
What happens when I do something like this:
Collapse JASS:
function x takes nothing returns nothing
local conditionfunc c=Condition function whatever)
local trigger t=CreateTrigger()
local triggercondition tc=TriggerAddCondition(t,c)
//some triggerevents
call DestroyCondition(c)
set t=null
set tc=null
set c=null
endfunction
Will the condition, which now does not exist in its primary form any more, get considered when a unit or whatever makes the trigger get evaluated?

Plx reply if you have a clue or allready (mass) tested.
Thx.
10-06-2006, 09:39 PM#2
blu_da_noob
You cannot destroy a condition/boolexpr if you need to use it in future. So the answer is no.
10-06-2006, 10:21 PM#3
UnMi
!!!
There is
Collapse JASS:
TriggerRemoveCondition
too. Now which version is the cleaning up one?
10-07-2006, 12:52 PM#4
BertTheJasser
@UnMi:TriggerRemoveAction is to remove conditionfunc from the trigger, not destroy the conditionfunc, which is DestroyCondition(whhichconditionfunc)'s job.

@blu_da_noob: I guess you missunderstood the question, so I repharse it: Whil the trigger stil do the check even if the conditionfunc itself does not exist as handle id anymore?
10-07-2006, 01:14 PM#5
Blade.dk
Quote:
Originally Posted by BertTheJasser
@UnMi:TriggerRemoveAction is to remove conditionfunc from the trigger, not destroy the conditionfunc, which is DestroyCondition(whhichconditionfunc)'s job.

TriggerRemoveCondition ;)
10-07-2006, 01:29 PM#6
UnMi
Hmm, so this means that if you are destroying a dynamic trigger with a condition, you would not have to "TriggerRemoveCondition" from it to prevent leaks?
10-07-2006, 02:54 PM#7
blu_da_noob
Quote:
Originally Posted by BertTheJasser
@blu_da_noob: I guess you missunderstood the question, so I repharse it: Whil the trigger stil do the check even if the conditionfunc itself does not exist as handle id anymore?

I did answer that question in my first post, but if you want a more explicitly stated answer: destroying a boolexpr/condition will mean it can no longer be used (I haven't checked if it causes it to evaluate to always true or false, but it will not check the actual condition).
10-07-2006, 05:02 PM#8
BertTheJasser
Thx. +rep to blu_da_noob

Edit:
can not rep you again xD

@UnMi: you must remove the condition and then destroy the condition func, if it is not used otherwise.