Switching to custom editing mode leads UE4 to crash


I’m developing a plugin that provides a custom editing mode. Here is its repository: GitHub - mvlabat/ForestGeneratorPlugin: TreeGeneratorPlugin is Unreal Engine 4 plugin for placing trees on terrain randomly.

When switching to the editing mode, UE4 crashes with the following call stack: http://pastebin.com/vtc7xnyZ

It looks like that in this line (engine\source\editor\unrealed\private\editormodemanager.cpp:108)

TSharedPtr<class IToolkitHost> Result = ToolkitHost.Pin();

ToolkitHost points to NULL. I can’t understand why it’s not set…

I’ve taken MeshPaint editing mode as an example to develop mine. Definitely, I’m missing something, but I can’t figure out what.

Would be glad for any help!

The harder a problem the more stupid it is… I declared redundant fields in my FEdModeForest class… They were

TSharedPtr<class FModeToolkit> Toolkit;
FEditorModeTools* Owner;