On Mon Oct 9 13:45:42 2023 +0000, Connor McAdams wrote:
That's not what native does. I could add a test to show this, but AFAIU it is unlikely that an HWND will ever end up reused.
Unless there's a way that an application can rely on this behavior, I don't think it matters what native does.
If I'm reading the wineserver code correctly, there can only really be 65488 user handles total, and each time a handle is destroyed it ends up in a LIFO free list. The index into the table makes up the low word of the handle. Each time a handle index is reused, a "generation" counter is incremented (with a valid range from 1 to 0xfffe inclusive), and this makes up the high word. So really you would just have to destroy and recreate the same handle 65534 times. I think you would have to be running Wine for a long time and opening/closing a lot of windows, but I don't think it's that unlikely for someone to have a program+use case that does it.