Fixed Mac OS build.
Fix OpenGL canvas freeze under Windows.