Browse Source

Merge branch 'leaks-again' of https://github.com/Perspex/Perspex into fix_carousel_presenter

Dan Walmsley 9 years ago
parent
commit
a790c034cb

+ 7 - 3
Perspex.sln

@@ -1,7 +1,7 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio 14
-VisualStudioVersion = 14.0.24720.0
+VisualStudioVersion = 14.0.25123.0
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perspex.Base", "src\Perspex.Base\Perspex.Base.csproj", "{B09B78D8-9B26-48B0-9149-D64A2F120F3F}"
 EndProject
@@ -351,32 +351,36 @@ Global
 		{3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|iPhone.Build.0 = Release|Any CPU
 		{3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
 		{3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+		{3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|x86.ActiveCfg = Release|Any CPU
+		{3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|x86.Build.0 = Release|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
+		{EC42600F-049B-43FF-AED1-8314D61B2749}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.AppStore|Any CPU.Build.0 = Release|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.AppStore|iPhone.ActiveCfg = Release|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.AppStore|iPhone.Build.0 = Release|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
+		{EC42600F-049B-43FF-AED1-8314D61B2749}.AppStore|x86.ActiveCfg = Debug|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.Debug|iPhone.ActiveCfg = Debug|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.Debug|iPhone.Build.0 = Debug|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+		{EC42600F-049B-43FF-AED1-8314D61B2749}.Debug|x86.ActiveCfg = Debug|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.Release|Any CPU.Build.0 = Release|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.Release|iPhone.ActiveCfg = Release|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.Release|iPhone.Build.0 = Release|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
 		{EC42600F-049B-43FF-AED1-8314D61B2749}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
-		{3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|x86.ActiveCfg = Release|Any CPU
-		{3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|x86.Build.0 = Release|Any CPU
+		{EC42600F-049B-43FF-AED1-8314D61B2749}.Release|x86.ActiveCfg = Release|Any CPU
 		{62024B2D-53EB-4638-B26B-85EEAA54866E}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
 		{62024B2D-53EB-4638-B26B-85EEAA54866E}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
 		{62024B2D-53EB-4638-B26B-85EEAA54866E}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU

+ 1 - 0
appveyor.yml

@@ -20,6 +20,7 @@ configuration:
   - Release
 
 after_test:
+- .\packages\JetBrains.dotMemoryUnit.2.1.20150828.125449\tools\dotMemoryUnit.exe -targetExecutable="%xunit20%\xunit.console.x86.exe" -returnTargetExitCode  --"tests\Perspex.LeakTests\bin\Release\Perspex.LeakTests.dll"
 - ps: nuget\build-appveyor.ps1
 
 artifacts:

+ 3 - 3
nuget/template/Perspex.Desktop.nuspec

@@ -21,9 +21,9 @@
       <dependency id="Rx-Linq" version="2.2.5" />
       <dependency id="Rx-Main" version="2.2.5" />
       <dependency id="Rx-PlatformServices" version="2.2.5" />
-      <dependency id="SharpDX" version="3.0.1"/>
-      <dependency id="SharpDX.Direct2D1" version="3.0.1"/>
-      <dependency id="SharpDX.DXGI" version="3.0.1"/>
+      <dependency id="SharpDX" version="3.0.2"/>
+      <dependency id="SharpDX.Direct2D1" version="3.0.2"/>
+      <dependency id="SharpDX.DXGI" version="3.0.2"/>
       <dependency id="Perspex" version="#VERSION#" />
     </dependencies>
   </metadata>

+ 14 - 14
src/Perspex.Base/PerspexObject.cs

@@ -23,17 +23,6 @@ namespace Perspex
     /// </remarks>
     public class PerspexObject : IPerspexObject, IPerspexObjectDebug, INotifyPropertyChanged, IPriorityValueOwner
     {
-        /// <summary>
-        /// Maintains a list of direct property binding subscriptions so that the binding source
-        /// doesn't get collected.
-        /// </summary>
-        /// <remarks>
-        /// If/when we provide a ClearBindings() method, then this collection will be need to be
-        /// moved to an instance field and indexed by property, but until that point a static
-        /// collection will suffice.
-        /// </remarks>
-        private static List<IDisposable> s_directBindings = new List<IDisposable>();
-
         /// <summary>
         /// The parent object that inherited values are inherited from.
         /// </summary>
@@ -45,6 +34,12 @@ namespace Perspex
         private readonly Dictionary<PerspexProperty, PriorityValue> _values =
             new Dictionary<PerspexProperty, PriorityValue>();
 
+        /// <summary>
+        /// Maintains a list of direct property binding subscriptions so that the binding source
+        /// doesn't get collected.
+        /// </summary>
+        private List<IDisposable> _directBindings;
+
         /// <summary>
         /// Event handler for <see cref="INotifyPropertyChanged"/> implementation.
         /// </summary>
@@ -402,17 +397,22 @@ namespace Perspex
 
                 IDisposable subscription = null;
 
+                if (_directBindings == null)
+                {
+                    _directBindings = new List<IDisposable>();
+                }
+
                 subscription = source
                     .Select(x => CastOrDefault(x, property.PropertyType))
-                    .Do(_ => { }, () => s_directBindings.Remove(subscription))
+                    .Do(_ => { }, () => _directBindings.Remove(subscription))
                     .Subscribe(x => DirectBindingSet(property, x));
 
-                s_directBindings.Add(subscription);
+                _directBindings.Add(subscription);
 
                 return Disposable.Create(() =>
                 {
                     subscription.Dispose();
-                    s_directBindings.Remove(subscription);
+                    _directBindings.Remove(subscription);
                 });
             }
             else

+ 1 - 1
src/Windows/Perspex.Win32/SystemDialogImpl.cs

@@ -40,7 +40,7 @@ namespace Perspex.Win32
                 var filterBuffer = new char[filters.Length];
                 filters.CopyTo(0, filterBuffer, 0, filterBuffer.Length);
 
-                var defExt = (dialog as SaveFileDialog)?.DefaultExtension.ToArray();
+                var defExt = (dialog as SaveFileDialog)?.DefaultExtension?.ToArray();
                 var fileBuffer = new char[256];
                 dialog.InitialFileName?.CopyTo(0, fileBuffer, 0, dialog.InitialFileName.Length);