summaryrefslogtreecommitdiffstats
path: root/state.rb
diff options
context:
space:
mode:
Diffstat (limited to 'state.rb')
-rw-r--r--state.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/state.rb b/state.rb
index eb2498a..993c6a8 100644
--- a/state.rb
+++ b/state.rb
@@ -123,11 +123,7 @@ class State
# Set this state to untrue
def drop
- return unless @active
- trace "Dropping #{self}"
- break_holds if @holds.size > 0
- becomes_defunct
- self.class.falling_edge.call(params)
+ becomes_defunct(true)
end
# Parameters to this state
@@ -137,10 +133,14 @@ class State
end
# Set this state to untrue without running any falling edge code
- def becomes_defunct
+ def becomes_defunct(drop=false)
return unless @active
- break_holds if @holds.size > 0
@active = false
+ break_holds if @holds.size > 0
+ if drop
+ trace "Dropping #{self}"
+ self.class.falling_edge.call(params)
+ end
@deps.each{ |x| x.release(self) }
State.gc
State.depsolve_all