aboutsummaryrefslogtreecommitdiff
path: root/src/mgl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mgl.c')
-rw-r--r--src/mgl.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mgl.c b/src/mgl.c
index 3bf8821..8988003 100644
--- a/src/mgl.c
+++ b/src/mgl.c
@@ -36,13 +36,14 @@ static int glx_context_init() {
None
};
+ context.fbconfigs = NULL;
context.visual_info = NULL;
context.fbconfig = NULL;
int numfbconfigs = 0;
- GLXFBConfig *fbconfigs = context.gl.glXChooseFBConfig(context.connection, DefaultScreen(context.connection), attr, &numfbconfigs);
+ context.fbconfigs = context.gl.glXChooseFBConfig(context.connection, DefaultScreen(context.connection), attr, &numfbconfigs);
for(int i = 0; i < numfbconfigs; i++) {
- context.visual_info = context.gl.glXGetVisualFromFBConfig(context.connection, fbconfigs[i]);
+ context.visual_info = context.gl.glXGetVisualFromFBConfig(context.connection, context.fbconfigs[i]);
if(!context.visual_info)
continue;
@@ -53,7 +54,7 @@ static int glx_context_init() {
continue;
}
- context.fbconfig = fbconfigs[i];
+ context.fbconfig = context.fbconfigs[i];
if(pict_format->direct.alphaMask > 0)
break;
@@ -62,9 +63,6 @@ static int glx_context_init() {
context.fbconfig = NULL;
}
- if(fbconfigs)
- XFree(fbconfigs);
-
if(!context.visual_info) {
fprintf(stderr, "mgl error: no appropriate visual found\n");
return -1;
@@ -78,6 +76,11 @@ static void glx_context_deinit() {
XFree(context.visual_info);
context.visual_info = NULL;
}
+
+ if(context.fbconfigs) {
+ XFree(context.fbconfigs);
+ context.fbconfigs = NULL;
+ }
}
int mgl_init(void) {