black window and time delay: Sync X and GL?

I have an application that has several windows.
But one window out of ten, has black window not drawing anything.
This does not happen always but only that window not to other windows. I am using glX on Macosx. But I’ve seen this, on Solaris and even on Windows. Of course, with the same source code.

So, I put some time delay between XCreateWindow() and GL-drawings. Though it does not remove the symptom of balck window, it make it less frequent.
But I do not know why.

It has something to do with the Async between X and GL, I guess.
I tried XSync() or glXWaitX() with no effects on the symptom.


Check your return values.