Browse Source

Catch D2D error and log it.

As to not mask e.g. underlying path parse error.
pull/692/head
Steven Kirk 10 years ago
parent
commit
472133d349
  1. 17
      src/Windows/Avalonia.Direct2D1/Media/StreamGeometryContextImpl.cs

17
src/Windows/Avalonia.Direct2D1/Media/StreamGeometryContextImpl.cs

@ -6,6 +6,8 @@ using Avalonia.Platform;
using SharpDX.Direct2D1;
using SweepDirection = SharpDX.Direct2D1.SweepDirection;
using D2D = SharpDX.Direct2D1;
using Avalonia.Logging;
using System;
namespace Avalonia.Direct2D1.Media
{
@ -76,7 +78,20 @@ namespace Avalonia.Direct2D1.Media
public void Dispose()
{
_sink.Close();
// Put a catch around sink.Close as it may throw if there were an error e.g. parsing a path.
try
{
_sink.Close();
}
catch (Exception ex)
{
Logger.Error(
LogArea.Visual,
this,
"GeometrySink.Close exception: {Exception}",
ex);
}
_sink.Dispose();
}
}

Loading…
Cancel
Save