fix dumb crash with dynamically initialized widgets

This commit is contained in:
Chris Forbes
2010-03-16 19:19:41 +13:00
parent f13ebcc0d2
commit 9290065ff9

View File

@@ -26,6 +26,8 @@ namespace OpenRA.Widgets
public Rectangle EventBounds; public Rectangle EventBounds;
public Widget Parent = null; public Widget Parent = null;
public Widget() { InputHandler = Lazy.New(() => BindHandler(Delegate)); }
public virtual void Initialize() public virtual void Initialize()
{ {
// Parse the YAML equations to find the widget bounds // Parse the YAML equations to find the widget bounds
@@ -54,8 +56,6 @@ namespace OpenRA.Widgets
child.Initialize(); child.Initialize();
EventBounds = Rectangle.Union(EventBounds, child.EventBounds); EventBounds = Rectangle.Union(EventBounds, child.EventBounds);
} }
InputHandler = Lazy.New(() => BindHandler(Delegate));
} }
static IWidgetDelegate BindHandler(string name) static IWidgetDelegate BindHandler(string name)