-
Notifications
You must be signed in to change notification settings - Fork 635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix more memory leaks when starting and closing DynamoRevit #14366
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -403,6 +403,7 @@ public override void Dispose() | |
{ | ||
cate.DisposeTree(); | ||
} | ||
Model.EntryAdded += AddEntry; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be |
||
Model.EntryUpdated -= UpdateEntry; | ||
Model.EntryRemoved -= RemoveEntry; | ||
|
||
|
@@ -425,12 +426,7 @@ private void InitializeCore() | |
searchIconAlignment = System.Windows.HorizontalAlignment.Left; | ||
|
||
// When Library changes, sync up | ||
Model.EntryAdded += entry => | ||
{ | ||
InsertEntry(MakeNodeSearchElementVM(entry), entry.Categories); | ||
RaisePropertyChanged("BrowserRootCategories"); | ||
}; | ||
|
||
Model.EntryAdded += AddEntry; | ||
Model.EntryUpdated += UpdateEntry; | ||
Model.EntryRemoved += RemoveEntry; | ||
|
||
|
@@ -440,6 +436,12 @@ private void InitializeCore() | |
InsertClassesIntoTree(LibraryRootCategories); | ||
} | ||
|
||
private void AddEntry(NodeSearchElement entry) | ||
{ | ||
InsertEntry(MakeNodeSearchElementVM(entry), entry.Categories); | ||
RaisePropertyChanged("BrowserRootCategories"); | ||
} | ||
|
||
private IEnumerable<RootNodeCategoryViewModel> CategorizeEntries(IEnumerable<NodeSearchElement> entries, bool expanded) | ||
{ | ||
var tempRoot = entries.GroupByRecursive<NodeSearchElement, string, NodeCategoryViewModel>( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2892,7 +2892,13 @@ public void Dispose() | |
dynamoViewModel.SideBarTabItems.CollectionChanged -= this.OnCollectionChanged; | ||
|
||
if (fileTrustWarningPopup != null) | ||
{ | ||
fileTrustWarningPopup.CleanPopup(); | ||
} | ||
//TODO code smell. | ||
var workspaceView = this.ChildOfType<WorkspaceView>(); | ||
workspaceView?.Dispose(); | ||
(workspaceView?.NodeAutoCompleteSearchBar?.Child as IDisposable)?.Dispose(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to dispose this specific control? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor point but how about disposing it inside the workspaceview's dispose method - would be cleaner. |
||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using System; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Specialized; | ||
using System.ComponentModel; | ||
|
@@ -174,6 +174,13 @@ private void UnregisterEventHandlers() | |
BackgroundPreviewViewModel.CanNavigateBackgroundPropertyChanged -= Watch3DViewModelNavigateBackgroundPropertyChanged; | ||
BackgroundPreviewViewModel.ViewMouseDown -= Watch3DViewModelOnViewMouseDown; | ||
} | ||
|
||
var settings = GetRunSettings(WorkspaceModel); | ||
if (settings != null) | ||
{ | ||
settings.PropertyChanged -= OnRunSettingsPropertyChanged; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does need to be unsubscribed here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because when Dynamo is shutdown the In a context like Revit where Dynamo can be shutdown and started over and over, this leads to leaks. In Sandbox it's not an issue. |
||
} | ||
|
||
} | ||
|
||
private void Watch3DViewModelOnViewMouseDown(object o, MouseButtonEventArgs mouseButtonEventArgs) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using System; | ||
using System; | ||
using System.Collections.ObjectModel; | ||
using System.IO; | ||
using System.Windows.Media.Imaging; | ||
|
@@ -266,6 +266,7 @@ private void MarkCurrentWorkspaceModified() | |
public void Dispose() | ||
{ | ||
this.viewLoadedParams.CurrentWorkspaceChanged -= OnCurrentWorkspaceChanged; | ||
this.viewLoadedParams.CurrentWorkspaceCleared += OnCurrentWorkspaceChanged; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure it's not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, it's probably a copy paste error, but I will double check and add it to #14379 |
||
if (linterManager != null) | ||
{ | ||
linterManager.PropertyChanged -= OnLinterManagerPropertyChange; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch @RobertGlobant20 @mjkkirschner