comparison 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
comparison
equal deleted inserted replaced
3217:26ce0b98f2fb 3218:81773a1eac83
26 #include "../SDL_sysvideo.h" 26 #include "../SDL_sysvideo.h"
27 #include "../SDL_pixels_c.h" 27 #include "../SDL_pixels_c.h"
28 28
29 #include "SDL_x11video.h" 29 #include "SDL_x11video.h"
30 30
31 #if SDL_VIDEO_DRIVER_PANDORA
32 #include "SDL_x11opengles.h"
33 #endif
31 34
32 /* Initialization/Query functions */ 35 /* Initialization/Query functions */
33 static int X11_VideoInit(_THIS); 36 static int X11_VideoInit(_THIS);
34 static void X11_VideoQuit(_THIS); 37 static void X11_VideoQuit(_THIS);
35 38
99 if (data->display) { 102 if (data->display) {
100 XCloseDisplay(data->display); 103 XCloseDisplay(data->display);
101 } 104 }
102 SDL_free(data->windowlist); 105 SDL_free(data->windowlist);
103 SDL_free(device->driverdata); 106 SDL_free(device->driverdata);
107 #if SDL_VIDEO_DRIVER_PANDORA
108 SDL_free(device->gles_data);
109 #endif
104 SDL_free(device); 110 SDL_free(device);
105 111
106 SDL_X11_UnloadSymbols(); 112 SDL_X11_UnloadSymbols();
107 } 113 }
108 114
128 SDL_OutOfMemory(); 134 SDL_OutOfMemory();
129 SDL_free(device); 135 SDL_free(device);
130 return NULL; 136 return NULL;
131 } 137 }
132 device->driverdata = data; 138 device->driverdata = data;
139
140 #if SDL_VIDEO_DRIVER_PANDORA
141 device->gles_data = (struct SDL_PrivateGLESData *) SDL_calloc(1, sizeof(SDL_PrivateGLESData));
142 if (!device->gles_data) {
143 SDL_OutOfMemory();
144 return NULL;
145 }
146 #endif
133 147
134 /* FIXME: Do we need this? 148 /* FIXME: Do we need this?
135 if ( (SDL_strncmp(XDisplayName(display), ":", 1) == 0) || 149 if ( (SDL_strncmp(XDisplayName(display), ":", 1) == 0) ||
136 (SDL_strncmp(XDisplayName(display), "unix:", 5) == 0) ) { 150 (SDL_strncmp(XDisplayName(display), "unix:", 5) == 0) ) {
137 local_X11 = 1; 151 local_X11 = 1;
196 device->GL_SetSwapInterval = X11_GL_SetSwapInterval; 210 device->GL_SetSwapInterval = X11_GL_SetSwapInterval;
197 device->GL_GetSwapInterval = X11_GL_GetSwapInterval; 211 device->GL_GetSwapInterval = X11_GL_GetSwapInterval;
198 device->GL_SwapWindow = X11_GL_SwapWindow; 212 device->GL_SwapWindow = X11_GL_SwapWindow;
199 device->GL_DeleteContext = X11_GL_DeleteContext; 213 device->GL_DeleteContext = X11_GL_DeleteContext;
200 #endif 214 #endif
215 #if SDL_VIDEO_DRIVER_PANDORA
216 device->GL_LoadLibrary = X11_GLES_LoadLibrary;
217 device->GL_GetProcAddress = X11_GLES_GetProcAddress;
218 device->GL_UnloadLibrary = X11_GLES_UnloadLibrary;
219 device->GL_CreateContext = X11_GLES_CreateContext;
220 device->GL_MakeCurrent = X11_GLES_MakeCurrent;
221 device->GL_SetSwapInterval = X11_GLES_SetSwapInterval;
222 device->GL_GetSwapInterval = X11_GLES_GetSwapInterval;
223 device->GL_SwapWindow = X11_GLES_SwapWindow;
224 device->GL_DeleteContext = X11_GLES_DeleteContext;
225 #endif
201 226
202 device->free = X11_DeleteDevice; 227 device->free = X11_DeleteDevice;
203 228
204 return device; 229 return device;
205 } 230 }