winit icon indicating copy to clipboard operation
winit copied to clipboard

Use an unique window class name per winit version

Open Zoxc opened this issue 2 years ago • 6 comments

This uses an unique window class name per winit version and checks for errors when registering class names to avoid unsafety.

Fixes https://github.com/rust-windowing/winit/issues/3132

Zoxc avatar Oct 11 '23 18:10 Zoxc

Having multiple instances of winit in the same application is not really supported.

Can you explain why you're hitting this issue? Maybe including CARGO_PKG_VERSION in the default name would be the better fix?

In any case, I do agree that we should do the error handling better.

madsmtm avatar Oct 12 '23 13:10 madsmtm

It's easy to end up with multiple different winit versions due to frequent incompatible releases, that's how I noticed the issue.

CARGO_PKG_VERSION is not guaranteed to be unique, unlike static addresses.

Zoxc avatar Oct 12 '23 13:10 Zoxc

Hmm, I guess I just don't see how you'd end up with running two versions of winit in the same binary?

madsmtm avatar Oct 12 '23 14:10 madsmtm

I'm running puffin_egui in a separate thread from the main GUI app.

Zoxc avatar Oct 12 '23 15:10 Zoxc

The event loop window class had the same issue, so I've changed that too.

Zoxc avatar Oct 13 '23 16:10 Zoxc

Yeah. I get multiple windows with multiple winit versions instead of a crash.

Zoxc avatar Feb 06 '24 00:02 Zoxc