Fixing valgrind errors.
One of the error was the result of an unitended recursive call to X11_GL_LoadLibrary which was also fixed. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402739
This commit is contained in:
parent
e6d4abc63e
commit
011c8c6dc3
3 changed files with 29 additions and 27 deletions
|
@ -65,6 +65,8 @@
|
|||
#define GL_UnloadObject SDL_UnloadObject
|
||||
#endif
|
||||
|
||||
static int X11_GL_InitializeMemory(_THIS);
|
||||
|
||||
int
|
||||
X11_GL_LoadLibrary(_THIS, const char *path)
|
||||
{
|
||||
|
@ -90,7 +92,8 @@ X11_GL_LoadLibrary(_THIS, const char *path)
|
|||
return -1;
|
||||
}
|
||||
// LoadLibrary may be called before WindowCreate!
|
||||
X11_GL_Initialize(_this);
|
||||
// Must create the memory used by GL
|
||||
X11_GL_InitializeMemory(_this);
|
||||
|
||||
/* Load new function pointers */
|
||||
_this->gl_data->glXGetProcAddress =
|
||||
|
@ -254,11 +257,10 @@ X11_GL_InitExtensions(_THIS)
|
|||
/* X11_PumpEvents(_this); */ /* can't do that because the windowlist may be inconsitent at this point */
|
||||
}
|
||||
|
||||
int
|
||||
X11_GL_Initialize(_THIS)
|
||||
static int
|
||||
X11_GL_InitializeMemory(_THIS)
|
||||
{
|
||||
if (_this->gl_data) {
|
||||
++_this->gl_data->initialized;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -270,18 +272,30 @@ X11_GL_Initialize(_THIS)
|
|||
SDL_OutOfMemory();
|
||||
return -1;
|
||||
}
|
||||
_this->gl_data->initialized = 1;
|
||||
|
||||
if (X11_GL_LoadLibrary(_this, NULL) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Initialize extensions */
|
||||
X11_GL_InitExtensions(_this);
|
||||
_this->gl_data->initialized = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
X11_GL_Initialize(_THIS)
|
||||
{
|
||||
|
||||
if (X11_GL_InitializeMemory(_this) < 0) {
|
||||
return -1;
|
||||
}
|
||||
++_this->gl_data->initialized;
|
||||
|
||||
if (X11_GL_LoadLibrary(_this, NULL) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Initialize extensions */
|
||||
X11_GL_InitExtensions(_this);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
X11_GL_Shutdown(_THIS)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue