openglcontrol: fixed freeing FBConfigs

git-svn-id: trunk@37115 -
This commit is contained in:
mattias 2012-04-30 19:17:13 +00:00
parent 3af8c6a1b7
commit 5465d579a1

View File

@ -445,23 +445,18 @@ begin
{$IFDEF lclgtk2} {$IFDEF lclgtk2}
if visual=nil then ; if visual=nil then ;
{$IFDEF UseFPGLX} {$IFDEF UseFPGLX}
FBConfigs:=nil;
if GLX_version_1_3(dpy) then begin if GLX_version_1_3(dpy) then begin
{ use approach recommended since glX 1.3 } { use approach recommended since glX 1.3 }
FBConfigsCount:=0; FBConfigsCount:=0;
FBConfigs:=nil; FBConfigs:=glXChooseFBConfig(dpy, DefaultScreen(dpy), AttrFB, FBConfigsCount);
try if FBConfigsCount = 0 then
FBConfigs:=glXChooseFBConfig(dpy, DefaultScreen(dpy), AttrFB, FBConfigsCount); raise Exception.Create('Could not find FB config');
if FBConfigsCount = 0 then
raise Exception.Create('Could not find FB config');
{ just choose the first FB config from the FBConfigs list. { just choose the first FB config from the FBConfigs list.
More involved selection possible. } More involved selection possible. }
FBConfig := FBConfigs^; FBConfig := FBConfigs^;
vi:=glXGetVisualFromFBConfig(dpy, FBConfig); vi:=glXGetVisualFromFBConfig(dpy, FBConfig);
finally
if FBConfigs<>nil then
XFree(FBConfigs);
end;
end else begin end else begin
vi:=glXChooseVisual(dpy, DefaultScreen(dpy), @attrList[0]); vi:=glXChooseVisual(dpy, DefaultScreen(dpy), @attrList[0]);
end; end;
@ -485,6 +480,8 @@ begin
PrivateShareList^.glxcontext, true) PrivateShareList^.glxcontext, true)
else else
glxcontext := glXCreateNewContext(dpy, FBConfig, GLX_RGBA_TYPE, nil, true); glxcontext := glXCreateNewContext(dpy, FBConfig, GLX_RGBA_TYPE, nil, true);
if FBConfigs<>nil then
XFree(FBConfigs);
end else begin end else begin
if (sharelist<>nil) then if (sharelist<>nil) then
glxcontext := glXCreateContext(dpy, vi, PrivateShareList^.glxcontext, glxcontext := glXCreateContext(dpy, vi, PrivateShareList^.glxcontext,