implying that the call to RegisterClassExA() is failing. A few lines above, the class name is generated based on the return value from QueryPerformanceCounter():
Since Rust tests are run in parallel by default, I believe the issue is that two threads are attempting to create a class at the same time, resulting in the same class name being generated and therefore and the call to RegisterClassExA() failing in one of the threads. That would also explain why we only see the error occasionally: most of the time, the two threads happen to get different values from QueryPerformanceCounter().
Assuming that is the case, I think this could be fixed by changing how the class name is generated, for instance by including the thread ID.
Hello! We've been using nih-plug in some of our tests, and we've noticed sporadic failures due to this assertion failing:
https://github.com/robbert-vdh/nih-plug/blob/ffe9b61fcb0441c9d33f4413f5ebe7394637b21f/src/event_loop/windows.rs#L86
implying that the call to
RegisterClassExA()
is failing. A few lines above, the class name is generated based on the return value fromQueryPerformanceCounter()
:https://github.com/robbert-vdh/nih-plug/blob/ffe9b61fcb0441c9d33f4413f5ebe7394637b21f/src/event_loop/windows.rs#L70-L75
Since Rust tests are run in parallel by default, I believe the issue is that two threads are attempting to create a class at the same time, resulting in the same class name being generated and therefore and the call to
RegisterClassExA()
failing in one of the threads. That would also explain why we only see the error occasionally: most of the time, the two threads happen to get different values fromQueryPerformanceCounter()
.Assuming that is the case, I think this could be fixed by changing how the class name is generated, for instance by including the thread ID.