U4-3007 - RouteDefinition should not store instance of controller

Created by Floris Robbemont 01 Oct 2013, 12:09:20 Updated by Shannon Deminick 24 Apr 2014, 06:56:53

Currently, the route definition class stores an instance of the current controller. This happens in the UmbracoMvcHandler class. However, this controller is only necessary when there's a post to a SurfaceController.

Also, this controller is never released using the ControllerFactory. This creates massive memory leaks overtime as controllers created using a system like Windsor are now never properly released.

To fix this I removed the need to store the instance. The name of controller was already stored in the route definition and I now use that name to create a new instance of the controller when necessary in the UmbracoPageResult class. The new instance is created using the ControllerFactory and is released properly after the controller has executed.

I will create a pull request with this change. I think this change is backwards compatible because all the changed classes were internal. However, when someone stores stuff inside their controllers (private fields or something) and wants to access them after the post, this will be breaking.


Floris Robbemont 01 Oct 2013, 12:13:49

Pull request: https://github.com/umbraco/Umbraco-CMS/pull/145

Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal


Backwards Compatible: True

Fix Submitted: Pull request

Affected versions:

Due in version: 6.2.0


Story Points: