ChrisAnd1998 / TaskbarXI

An application written in C++ to modify the Windows 11 Taskbar.
https://chrisandriessen.nl/
GNU General Public License v3.0
1.55k stars 161 forks source link

fix GDI leaks that case app crashing #128

Closed hussien89aa closed 2 years ago

hussien89aa commented 2 years ago

I work for the Microsoft Graphics team, and I notice that your app is leaking GDI objects. These leaks make your app crash suddenly on the user. Once your all use all quotes for GDI object per process because of the leak the app will crash. Please fix/verify PR as soon as possible. I address leaks as much as I can I am not sure I address all leaks please find other leaks if there are any and fix them, your app is a good and nice App.

Leak issue fixed

When you use CombineRgn to combine three areas CombineRgn(region_Both, region_ShellTrayWnd, region_TrayNotifyWnd, RGN_OR); you need to delete the old two (region_ShellTrayWnd, region_TrayNotifyWnd) since nobody can delete them. Even SetWindowRgn going to delete new area region_Both only old you need to delete them.

Also, you need to release object from the kernel space using DeleteObject do not set the object to NULL it is a leak. as MSDN said "When you no longer need the HRGN object, call the DeleteObject" Thanks Hussein