Sometimes in my OpenGL application I get an access violation in the following API call:
wglMakeCurrent(NULL, NULL);
The application only has one single thread, and I've checked that before that call, both the DC and HGLRC that are currently used are correct and valid.
There are three different windows with OpenGL content, and they're all redrawn on WM_PAINT messages and if a refresh is required due to user interaction (e.g., picking an object).
Also this access violation happens on different machines with different graphic cards, so I don't think it's a driver issue.
What could make this API call crash? What should I investigate in the app code to find out where/why this happens? I'm really lost here since I've checked everything I could think of already. I hope someone can give me hints/ideas on what more to check.