Reputation: 794
Can one cause problems by prematurely releasing a Windows GDI object? With memory one can prematurely delete/free a buffer and cause very serious problems indeed. How about GDI? Can one cause a crash or UI painting issues by prematurely releasing a GDI object?
Upvotes: 0
Views: 103
Reputation: 11311
You can't delete a GDI object that is currently selected into any device context (DC): https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-deleteobject
After you delete an object, its handle is invalid, so you can't select it into DC.
What other scenario do you have in mind?
Upvotes: 1