Not register event handler for Dispatcher.ShutdownStarted event#2888
Not register event handler for Dispatcher.ShutdownStarted event#2888ke-yu merged 6 commits intoDynamoDS:masterfrom
Conversation
There was a problem hiding this comment.
I would have hoped this dynNoteView_Unloaded gets named OnNoteViewUnloaded, and dynNoteView_Loaded be named OnNoteViewLoaded. But then I think you didn't do that so as to keep the naming convention in the class, which if fair enough (I'd also move the Unloaded to after Loaded).
Same for dynWorkspaceView_Unloaded below, but please don't change just because I mentioned it, this is my personal opinion :)
There was a problem hiding this comment.
make sense. Let me update it. :-)
|
LGTM! |
There was a problem hiding this comment.
I bet you intended to remove this before pull request creation ;)
|
Again, minor comments that can optionally be done. Otherwise, LGTM! |
|
This was my change originally. If memory serves, I added this because Unloaded was not being called for certain views, and ShutdownStarted was. I believe I got this idea here: Re-reading this, it makes sense that ShutdownStarted wouldn't be called until Revit closes because the dispatcher belongs to the thread. Nonetheless, this was done originally because when Close is called on a window, as it is during one of our numerous ways of shutting down Dynamo, the Unloaded event is not fired. Some things have changed about the shutdown sequence so as long as you can verify that every way we shut down dynamo (by Exit, or by closing the window) that unloaded is fired, LGTM. |
|
Yep, verified all these view unloaded event handlers are invoked when Dynamo is closed in Revit. |
Not register event handler for Dispatcher.ShutdownStarted event
It is part of effort to fix memory leak issue on Revit...
RevitDynamoModelis referenced by many objects, when looking at the reference retention path,Dispatcheris one if them.Related pull requests:
As
Dispatcheris associated with thread, it is sort of static object, registering event handler forDispatcher.ShutdownStartedprohibits the view from being garbage collected even it is unloaded. Plus,Dispatcher.ShutdownStartedis only fired when Revit application is shut down, it doesn't make sense to do "unload" things in it. Replace them withUnloadedevent.Reviewers: