Screen deactivate overflow issue

Topics: Bugs, UI Architecture
Apr 29, 2013 at 11:55 AM
If you try to close something ELSE on deactivate event (like another viewModel from a conductor ) you get stackoverflow...
One fix i did is..What do you think ?
void IDeactivate.Deactivate(bool close) {
        if(IsActive || (IsInitialized && close)) {
            AttemptingDeactivation(this, new DeactivationEventArgs {
                WasClosed = close
            });

            bool wasActive = isActive;
            IsActive = false;
            Log.Info("Deactivating {0}.", this);
            OnDeactivate(close);

            if (wasActive)
            {
                Deactivated(this, new DeactivationEventArgs
                {
                    WasClosed = close
                });
            }


            if(close) {
                Views.Clear();
                Log.Info("Closed {0}.", this);
            }
        }
    }

void IDeactivate.Deactivate(bool close) {
            if(IsActive || (IsInitialized && close)) {
                AttemptingDeactivation(this, new DeactivationEventArgs {
                    WasClosed = close
                });

                IsActive = false;
                Log.Info("Deactivating {0}.", this);
                OnDeactivate(close);

                Deactivated(this, new DeactivationEventArgs {
                    WasClosed = close
                });

                if(close) {
                    Views.Clear();
                    Log.Info("Closed {0}.", this);
                }
            }
        }