Skip to content

Commit

Permalink
Merge pull request #107 from runceel/fix105
Browse files Browse the repository at this point in the history
Fixing for #105
  • Loading branch information
runceel committed May 22, 2019
2 parents 41c5ea6 + 5efc684 commit 031cfec
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 5 deletions.
8 changes: 7 additions & 1 deletion Source/ReactiveProperty.NETStandard/ReactivePropertySlim.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,11 @@ public ReadOnlyReactivePropertySlim(IObservable<T> source, T initialValue = defa
this.mode = mode;
this.equalityComparer = equalityComparer ?? EqualityComparer<T>.Default;
sourceSubscription = source.Subscribe(this);
if (IsDisposed)
{
sourceSubscription.Dispose();
sourceSubscription = null;
}
}

/// <summary>
Expand Down Expand Up @@ -440,7 +445,8 @@ public void Dispose()
node.OnCompleted();
node = node.Next;
}
sourceSubscription.Dispose();

sourceSubscription?.Dispose();
sourceSubscription = null;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{BF2E72F9-149B-4687-ABCD-7B949430FFDE}</ProjectGuid>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TemplateGuid>{9ef11e43-1701-4396-8835-8392d57abb70}</TemplateGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Reactive.Bindings</RootNamespace>
<AssemblyName>ReactiveProperty.Android</AssemblyName>
<FileAlignment>512</FileAlignment>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v8.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Binary\MonoAndroid\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>..\..\Binary\MonoAndroid\ReactiveProperty.Android.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Mono.Android" />
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BindingSupportExtensions.cs" />
<Compile Include="Extensions\ViewEventExtensions.cs" />
<Compile Include="Internal\AccessorCache.cs" />
<Compile Include="ListAdapter.cs" />
<Compile Include="ObservableCollectionAdapter.cs" />
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.1" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\values\strings.xml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\drawable\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ReactiveProperty.NETStandard\ReactiveProperty.NETStandard.csproj">
<Project>{157f0f88-34ac-4c49-971f-7027aac757ae}</Project>
<Name>ReactiveProperty.NETStandard</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,12 @@ public void UnsubscribeTest()

rp.Dispose();
}

[TestMethod]
public void CreateFromObservableThatCompleteImmidiataly()
{
var x = Observable.Return(1).ToReadOnlyReactivePropertySlim();
x.Value.Is(1);
}
}
}

0 comments on commit 031cfec

Please sign in to comment.