DynamoDS/Dynamo — pull request #2959 by Benglin (2014-11-04 09:27:51+00:00)
Title: Fix a crash when updating to daily build

Background
-----
This pull request is meant for fixing [a crash when user updates from 0.7.3 to daily build](http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-5298). The crash takes place during Revit shutdown. Due to the fact that ```DynamoRevit.RevitDynamoModel``` has already been set to ```null```, the call to ```ExecuteOnIdleAsync``` crashes when it tries to access it:

```cs
class RevitDynamoModel
{
public override void ResetEngine(bool markNodesAsDirty = false)
{
// Crashes inside the following method.
IdlePromise.ExecuteOnIdleAsync(ResetEngineInternal);
}
}
```

Changes
-----
The ```RevitDynamoModel.ResetEngine``` method gets called from ```DynamoModel.CleanWorkbench```, which in turn gets called from ```DynamoModel.ShutDownCore``` as part of the shutdown process. Since ```ShutDownCore``` is already doing ```EngineController.Dispose```, there is no real need to destroy ```EngineController``` inside ```CleanWorkbench``` for when ```DynamoModel``` shuts down. For that reason, ```ResetEngine``` is called conditionally as shown:

```cs
internal void CleanWorkbench()
{
// Other code...

if (!ShutdownRequested)
this.ResetEngine();

// More code...
}
```

Testing & Review
-----
- [ ] @riteshchandawar could consistently reproduce the crash, and he will be testing this fix tomorrow morning.

- [ ] @ikeough, please have a look at this.

Thanks, guys!