XSync() is already called when there is a whole window only. When GL child window is deleted shortly after resize X error (request code 12, which is X_ConfigureWindow) may happen. XConfigureWindow is called for child window from sync_client_position. Then, destroy_whole_window() doesn't hit XSync() path because there is no whole_window. client_window is destroyed from opengl.c:release_gl_drawable() independently (that may happen right from X11DRV_DestroyWindow() or later if the drawable is still referenced elsewhere) and that may happen before XConfigureWindow request is processed. We can't flush in release_gl_drawable() as window data is unavailable at that moment and it is unknown which display to flush.