diff src/video/x11/SDL_x11video.c @ 3218:81773a1eac83

Patch from David Carre: I fixed a bug in the "SDL_DestroyRenderer()" function in the pandora x11 renderer (in fact the bug was in the "X11_GLES_MakeCurrent()" function) that was causing a crash when exiting SDL. There was a problem while terminating the x11 egl window, that was preventing to quit/close SDL/SDL-window then reload SDL/SDL-window inside the same application.
author Sam Lantinga <slouken@libsdl.org>
date Thu, 30 Jul 2009 14:53:57 +0000
parents 089a77aebb7d
children 76f9b76ddf0f
line wrap: on
line diff
--- a/src/video/x11/SDL_x11video.c	Sun Jul 19 08:04:59 2009 +0000
+++ b/src/video/x11/SDL_x11video.c	Thu Jul 30 14:53:57 2009 +0000
@@ -28,6 +28,9 @@
 
 #include "SDL_x11video.h"
 
+#if SDL_VIDEO_DRIVER_PANDORA
+#include "SDL_x11opengles.h"
+#endif
 
 /* Initialization/Query functions */
 static int X11_VideoInit(_THIS);
@@ -101,6 +104,9 @@
     }
     SDL_free(data->windowlist);
     SDL_free(device->driverdata);
+#if SDL_VIDEO_DRIVER_PANDORA
+    SDL_free(device->gles_data);
+#endif
     SDL_free(device);
 
     SDL_X11_UnloadSymbols();
@@ -131,6 +137,14 @@
     }
     device->driverdata = data;
 
+#if SDL_VIDEO_DRIVER_PANDORA
+    device->gles_data = (struct SDL_PrivateGLESData *) SDL_calloc(1, sizeof(SDL_PrivateGLESData));
+    if (!device->gles_data) {
+        SDL_OutOfMemory();
+        return NULL;
+    }
+#endif
+
     /* FIXME: Do we need this?
        if ( (SDL_strncmp(XDisplayName(display), ":", 1) == 0) ||
        (SDL_strncmp(XDisplayName(display), "unix:", 5) == 0) ) {
@@ -198,6 +212,17 @@
     device->GL_SwapWindow = X11_GL_SwapWindow;
     device->GL_DeleteContext = X11_GL_DeleteContext;
 #endif
+#if SDL_VIDEO_DRIVER_PANDORA
+    device->GL_LoadLibrary = X11_GLES_LoadLibrary;
+    device->GL_GetProcAddress = X11_GLES_GetProcAddress;
+    device->GL_UnloadLibrary = X11_GLES_UnloadLibrary;
+    device->GL_CreateContext = X11_GLES_CreateContext;
+    device->GL_MakeCurrent = X11_GLES_MakeCurrent;
+    device->GL_SetSwapInterval = X11_GLES_SetSwapInterval;
+    device->GL_GetSwapInterval = X11_GLES_GetSwapInterval;
+    device->GL_SwapWindow = X11_GLES_SwapWindow;
+    device->GL_DeleteContext = X11_GLES_DeleteContext;
+#endif
 
     device->free = X11_DeleteDevice;