Skip to content

Commit

Permalink
Some small fixes, these should help to track an issue the tests had.
Browse files Browse the repository at this point in the history
[release]
  • Loading branch information
Lakritzator committed Dec 4, 2018
1 parent 35dc75e commit 53ae915
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Dapplo.Windows.Common/Structs/NativeRect.cs
Expand Up @@ -277,7 +277,7 @@ public bool Equals(NativeRect other)
/// Checks if this NativeRect is empty
/// </summary>
/// <returns>true when empty</returns>
public bool IsEmpty => Width * Height == 0;
public bool IsEmpty => unchecked (Width * Height) == 0;

/// <inheritdoc />
[Pure]
Expand Down
2 changes: 1 addition & 1 deletion src/Dapplo.Windows.Common/Structs/NativeSize.cs
Expand Up @@ -204,7 +204,7 @@ public NativeSize(int width, int height)

/// <inheritdoc />
[Pure]
public int CompareTo(NativeSize other) => (other.Width * other.Height).CompareTo(Width * Height);
public int CompareTo(NativeSize other) => unchecked (other.Width * other.Height).CompareTo(unchecked(Width * Height));

/// <inheritdoc />
[Pure]
Expand Down
2 changes: 1 addition & 1 deletion src/Dapplo.Windows.Common/Structs/NativeSizeFloat.cs
Expand Up @@ -315,7 +315,7 @@ public bool Equals(NativeSizeFloat other)

/// <inheritdoc />
[Pure]
public int CompareTo(NativeSizeFloat other) => (other.Width * other.Height).CompareTo(Width * Height);
public int CompareTo(NativeSizeFloat other) => unchecked(other.Width * other.Height).CompareTo(unchecked (Width * Height));

/// <inheritdoc />
[Pure]
Expand Down
3 changes: 2 additions & 1 deletion src/Dapplo.Windows.Messages/Dapplo.Windows.Messages.csproj
Expand Up @@ -9,9 +9,10 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ClrHeapAllocationAnalyzer" Version="1.0.0.9" >
<PackageReference Include="ClrHeapAllocationAnalyzer" Version="1.0.0.9">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Dapplo.Log" Version="1.3.11" />
<PackageReference Include="System.Reactive" Version="4.1.2" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/Dapplo.Windows.Messages/WinProcHandler.cs
Expand Up @@ -28,6 +28,7 @@
using System.Linq;
using System.Reactive.Disposables;
using System.Windows.Interop;
using Dapplo.Log;

#endregion

Expand All @@ -38,6 +39,7 @@ namespace Dapplo.Windows.Messages
/// </summary>
public class WinProcHandler
{
private static readonly LogSource Log = new LogSource();
private static HwndSource _hWndSource;

/// <summary>
Expand All @@ -64,14 +66,12 @@ private HwndSource MessageHandlerWindow
{
return _hWndSource;
}
if (_hWndSource != null && !_hWndSource.IsDisposed)
{
return _hWndSource;
}
// Create a new message window
_hWndSource = CreateMessageWindow();
Log.Verbose().WriteLine("MessageHandlerWindow with handle {0} was created.", _hWndSource.Handle);
_hWndSource.Disposed += (sender, args) =>
{
Log.Verbose().WriteLine("MessageHandlerWindow with handle {0} is disposed.", _hWndSource.Handle);
UnsubscribeAllHooks();
};
// Hook automatic removing of all the hooks
Expand Down

0 comments on commit 53ae915

Please sign in to comment.