Browse Source

Merge branch 'master' into alloc-boxing

Jumar Macato 6 years ago
parent
commit
62e66c8daf

+ 5 - 3
src/Avalonia.Base/Utilities/WeakEventHandlerManager.cs

@@ -142,10 +142,12 @@ namespace Avalonia.Utilities
                     _data = ndata;
                 }
 
+                MethodInfo method = s.Method;
+
                 var subscriber = (TSubscriber)s.Target;
-                if (!s_Callers.TryGetValue(s.Method, out var caller))
-                    s_Callers[s.Method] = caller =
-                        (CallerDelegate)Delegate.CreateDelegate(typeof(CallerDelegate), null, s.Method);
+                if (!s_Callers.TryGetValue(method, out var caller))
+                    s_Callers[method] = caller =
+                        (CallerDelegate)Delegate.CreateDelegate(typeof(CallerDelegate), null, method);
                 _data[_count] = new Descriptor
                 {
                     Caller = caller,

+ 7 - 4
src/Avalonia.X11/X11Window.cs

@@ -100,14 +100,17 @@ namespace Avalonia.X11
 
             int defaultWidth = 300, defaultHeight = 200;
 
-            if (!_popup)
+            if (!_popup && Screen != null)
             {
                 var monitor = Screen.AllScreens.OrderBy(x => x.PixelDensity)
                    .FirstOrDefault(m => m.Bounds.Contains(Position));
 
-                // Emulate Window 7+'s default window size behavior.
-                defaultWidth = (int)(monitor.WorkingArea.Width * 0.75d);
-                defaultHeight = (int)(monitor.WorkingArea.Height * 0.7d);
+                if (monitor != null)
+                {
+                    // Emulate Window 7+'s default window size behavior.
+                    defaultWidth = (int)(monitor.WorkingArea.Width * 0.75d);
+                    defaultHeight = (int)(monitor.WorkingArea.Height * 0.7d);
+                }
             }
 
             _handle = XCreateWindow(_x11.Display, _x11.RootWindow, 10, 10, defaultWidth, defaultHeight, 0,