protected virtual void OnDisable() { m_AutomaticGraphProcessor?.StopTimer(); CommandDispatcher.UnregisterObserver(m_AutomaticGraphProcessor); CommandDispatcher.UnregisterObserver(m_GraphProcessingStatusObserver); CommandDispatcher.UnregisterObserver(m_SidePanelObserver); UnloadGraph(); if (m_ErrorToolbar != null) { m_GraphView.Remove(m_ErrorToolbar); } rootVisualElement.Remove(m_GraphContainer); if (m_MainToolbar != null) { rootVisualElement.Remove(m_MainToolbar); } m_GraphView = null; m_MainToolbar = null; m_ErrorToolbar = null; m_BlankPage = null; // Calling Dispose() manually to clean things up now, not at GC time. CommandDispatcher.Dispose(); CommandDispatcher = null; PluginRepository?.Dispose(); PluginRepository = null; }
/// <summary> /// Callback for the <see cref="DetachFromPanelEvent"/>. /// </summary> /// <param name="e">The event.</param> protected void OnLeavePanel(DetachFromPanelEvent e) { m_Dispatcher?.UnregisterObserver(m_Observer); }