[BUG] Fix GDI Leak at open main menu (#219), version 1.0.21.3

This commit is contained in:
Markus Hofknecht 2021-10-13 17:17:33 +02:00
parent 1e330d40a8
commit 49ea3cd7fe
2 changed files with 7 additions and 4 deletions

View file

@ -39,5 +39,5 @@ using System.Runtime.InteropServices;
// 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.0.21.2")]
[assembly: AssemblyFileVersion("1.0.21.2")]
[assembly: AssemblyVersion("1.0.21.3")]
[assembly: AssemblyFileVersion("1.0.21.3")]

View file

@ -112,9 +112,12 @@ namespace SystemTrayMenu.UserInterface
if (threadsLoading)
{
rotationAngle += 5;
using Bitmap bitmapLoading = new Bitmap(ImagingHelper.RotateImage(LoadingIcon.ToBitmap(), rotationAngle));
using Bitmap bitmapLoading = LoadingIcon.ToBitmap();
using Bitmap bitmapLoadingRotated = new Bitmap(ImagingHelper.RotateImage(bitmapLoading, rotationAngle));
DisposeIconIfNotDefaultIcon();
notifyIcon.Icon = Icon.FromHandle(bitmapLoading.GetHicon());
IntPtr hIcon = bitmapLoadingRotated.GetHicon();
notifyIcon.Icon = (Icon)Icon.FromHandle(hIcon).Clone();
DllImports.NativeMethods.User32DestroyIcon(hIcon);
}
else
{