139: Application crashes on Windows User switch

This commit is contained in:
Anton Kasyanov
2019-02-25 21:38:52 +02:00
parent ff36d15b75
commit 9d54613170

View File

@@ -1,4 +1,5 @@
using System; using System;
using System.Runtime.InteropServices;
using EveOPreview.Services.Interop; using EveOPreview.Services.Interop;
namespace EveOPreview.Services.Implementation namespace EveOPreview.Services.Implementation
@@ -45,6 +46,12 @@ namespace EveOPreview.Services.Implementation
// a thumbnail source // a thumbnail source
this._handle = IntPtr.Zero; this._handle = IntPtr.Zero;
} }
catch (COMException)
{
// This exception is raised if DWM is suddenly not available
// (f.e. when switching between Windows user accounts)
this._handle = IntPtr.Zero;
}
} }
public void Unregister() public void Unregister()
@@ -61,6 +68,10 @@ namespace EveOPreview.Services.Implementation
catch (ArgumentException) catch (ArgumentException)
{ {
} }
catch (COMException)
{
// This exception is raised when DWM is not available for some reason
}
} }
public void Move(int left, int top, int right, int bottom) public void Move(int left, int top, int right, int bottom)
@@ -81,7 +92,11 @@ namespace EveOPreview.Services.Implementation
} }
catch (ArgumentException) catch (ArgumentException)
{ {
//This exception will be thrown if the EVE client disappears while this method is running // This exception will be thrown if the EVE client disappears while this method is running
}
catch (COMException)
{
// This exception is raised when DWM is not available for some reason
} }
} }
} }