Solution
The problem occurs when using a Call Sequence step that creates a new execution as part of your test framework. This triggers switching between execution windows in the sequence editor under certain configurations, leading to a GDI object leak and eventually causing the error you are encountering.
This issue was reported as a bug in the 2022 version of TestStand and was fixed in the 2023 Q4 release.