private void SetupContext() { m_Results?.Dispose(); m_ResultView?.Dispose(); if (m_SearchContext != null) { m_SearchContext.Dispose(); m_SearchContext.asyncItemReceived -= OnAsyncItemsReceived; } var providerIds = m_EnabledProviderIds.Count != 0 ? m_EnabledProviderIds : SearchService.GetActiveProviders().Select(p => p.id); m_SearchContext = SearchService.CreateContext(providerIds, m_TextProperty.stringValue, SearchSettings.GetContextOptions()); m_SearchContext.asyncItemReceived += OnAsyncItemsReceived; m_Results = new SortedSearchList(m_SearchContext); m_ResultView = new SearchResultView(m_Results); RefreshResults(); }
public void OnDisable() { m_SearchContext.asyncItemReceived -= OnAsyncItemsReceived; m_SearchContext.Dispose(); m_Results.Dispose(); }