Skip to content
Browse files

Revert "Ensure Surface::Layers is always initialized"

This reverts commit 2e79dce.
  • Loading branch information...
1 parent 77726d5 commit b99cd42c077897270e565c7e47d80950ecb1a27a @alanmcgovern alanmcgovern committed May 4, 2011
Showing with 10 additions and 4 deletions.
  1. +10 −4 src/runtime.cpp
View
14 src/runtime.cpp
@@ -442,10 +442,6 @@ Surface::Surface (MoonWindow *window)
SetRuntimeOptions (moonlight_flags);
EnsureManagedPeer ();
-
- // Must happen after EnsureManagedPeer!
- layers = MoonUnmanagedFactory::CreateUIElementCollection ();
- layers->unref ();
}
Surface::~Surface ()
@@ -764,6 +760,11 @@ Surface::ToplevelLoaded (UIElement *element)
void
Surface::AttachLayer (UIElement *layer)
{
+ if (layers == NULL) {
+ layers = MoonUnmanagedFactory::CreateHitTestCollection ();
+ layers->unref ();
+ }
+
if (layer == toplevel)
layers->Insert (0, Value(layer));
else {
@@ -780,6 +781,11 @@ Surface::AttachLayer (UIElement *layer)
void
Surface::DetachLayer (UIElement *layer)
{
+ if (layers == NULL) {
+ layers = MoonUnmanagedFactory::CreateUIElementCollection ();
+ layers->unref ();
+ }
+
// if the layer contained the last UIElement receiving mouse input, clear the input list.
if (!input_list->IsEmpty() && ((UIElementNode*)input_list->Last())->uielement == layer) {
delete input_list;

0 comments on commit b99cd42

Please sign in to comment.
Something went wrong with that request. Please try again.