From 4f924e0917167ff01623dbae73f9a5f401e6ff02 Mon Sep 17 00:00:00 2001 From: Casey Dahlin Date: Tue, 7 Oct 2008 13:12:09 -0400 Subject: Fix dependency issue with dropping. A dropping state now holds its dependencies until after running the falling edge, but shuts down its dependents before. --- state.rb | 14 +++++++------- 1 file 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 -- cgit