The SwapInterval APIs should fail without a current OpenGL context.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 18 Jul 2011 14:31:37 -0700
changeset 5571 a036283f779d
parent 5570 70b6f92e4539
child 5572 32a785da3f49
The SwapInterval APIs should fail without a current OpenGL context.
src/video/SDL_video.c
--- a/src/video/SDL_video.c	Mon Jul 18 14:30:46 2011 -0700
+++ b/src/video/SDL_video.c	Mon Jul 18 14:31:37 2011 -0700
@@ -2510,8 +2510,10 @@
     if (!_this) {
         SDL_UninitializedVideo();
         return -1;
-    }
-    if (_this->GL_SetSwapInterval) {
+    } else if (_this->current_glctx == NULL) {
+        SDL_SetError("No OpenGL context has been made current");
+        return -1;
+    } else if (_this->GL_SetSwapInterval) {
         return _this->GL_SetSwapInterval(_this, interval);
     } else {
         SDL_SetError("Setting the swap interval is not supported");
@@ -2525,8 +2527,10 @@
     if (!_this) {
         SDL_UninitializedVideo();
         return -1;
-    }
-    if (_this->GL_GetSwapInterval) {
+    } else if (_this->current_glctx == NULL) {
+        SDL_SetError("No OpenGL context has been made current");
+        return -1;
+    } else if (_this->GL_GetSwapInterval) {
         return _this->GL_GetSwapInterval(_this);
     } else {
         SDL_SetError("Getting the swap interval is not supported");