Hot Door CORE Forum
GDI leak in Windows Illustrator -- solved - Printable Version

+- Hot Door CORE Forum (http://hotdoorcore.com/forum)
+-- Forum: All forums (http://hotdoorcore.com/forum/forumdisplay.php?fid=1)
+--- Forum: General discussion (http://hotdoorcore.com/forum/forumdisplay.php?fid=3)
+--- Thread: GDI leak in Windows Illustrator -- solved (/showthread.php?tid=338)



GDI leak in Windows Illustrator -- solved - Rick Johnson - 02-21-2023

I have a plugin tool that changes its cursor depending on its location to use various built-in Adobe scale or rotate cursors. For example, it may call

Code:
Code:
hdi::core::Cursor(hdi::core::Cursor::AdobeCursor::ScaleHorizontalCursor).enable();

The code works perfectly for both Mac and Windows, but with AI 2019-2023 under Windows 10, each call to set/enable a cursor creates GDI objects. As one moves the cursor, you can see the number of GDI objects grow from just under 1,500 to 9,999, at which point Illustrator becomes sluggish and unresponsive. Switching to another tool doesn't reduce the GDI count.

But I figured out the problem. It wasn't just showing the built-in cursor, it created a new copy of it every time the cursor moved another pixel. I solved this by creating my own version of each built-in scale and rotate cursor at startup, then enabling that copy as needed.