Skip to content

Commit

Permalink
[BUG] A generic error occurred in GDI+. at GetHicon Load_Tick (#361),…
Browse files Browse the repository at this point in the history
… version 1.2.8.4
  • Loading branch information
Hofknecht committed Feb 20, 2022
1 parent 7256910 commit eaf755e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.8.3")]
[assembly: AssemblyFileVersion("1.2.8.3")]
[assembly: AssemblyVersion("1.2.8.4")]
[assembly: AssemblyFileVersion("1.2.8.4")]
15 changes: 9 additions & 6 deletions UserInterface/AppNotifyIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,15 @@ private void Load_Tick(object sender, EventArgs e)
{
if (threadsLoading)
{
rotationAngle += 5;
using Bitmap bitmapLoading = Resources.StaticResources.LoadingIcon.ToBitmap();
using Bitmap bitmapLoadingRotated = new(ImagingHelper.RotateImage(bitmapLoading, rotationAngle));
IntPtr hIcon = bitmapLoadingRotated.GetHicon();
notifyIcon.Icon = (Icon)Icon.FromHandle(hIcon).Clone();
DllImports.NativeMethods.User32DestroyIcon(hIcon);
notifyIcon.Icon = Resources.StaticResources.LoadingIcon;

// see #361, rotating icon caused rare GDI+ exception at GetHicon
// rotationAngle += 5;
// using Bitmap bitmapLoading = Resources.StaticResources.LoadingIcon.ToBitmap();
// using Bitmap bitmapLoadingRotated = new(ImagingHelper.RotateImage(bitmapLoading, rotationAngle));
// IntPtr hIcon = bitmapLoadingRotated.GetHicon();
// notifyIcon.Icon = (Icon)Icon.FromHandle(hIcon).Clone();
// DllImports.NativeMethods.User32DestroyIcon(hIcon);
}
else
{
Expand Down

0 comments on commit eaf755e

Please sign in to comment.