Commit fd8698ff authored by David Lonie's avatar David Lonie Committed by Kitware Robot
Browse files

Merge topic 'segfault_in_create_awindow'

46187e3c missing check
90f09635

 Segfault in create awindow
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !2139
parents d39c5fbc 46187e3c
...@@ -204,7 +204,7 @@ GLXFBConfig vtkXOpenGLRenderWindowTryForFBConfig(Display *DisplayId, ...@@ -204,7 +204,7 @@ GLXFBConfig vtkXOpenGLRenderWindowTryForFBConfig(Display *DisplayId,
int tmp; int tmp;
GLXFBConfig* fb = glXChooseFBConfig(DisplayId, XDefaultScreen(DisplayId), GLXFBConfig* fb = glXChooseFBConfig(DisplayId, XDefaultScreen(DisplayId),
attributes, &tmp); attributes, &tmp);
if (tmp > 0) if (fb && tmp > 0)
{ {
GLXFBConfig result = fb[0]; GLXFBConfig result = fb[0];
XFree(fb); XFree(fb);
...@@ -495,6 +495,11 @@ void vtkXOpenGLRenderWindow::CreateAWindow() ...@@ -495,6 +495,11 @@ void vtkXOpenGLRenderWindow::CreateAWindow()
if (!this->WindowId) if (!this->WindowId)
{ {
v = this->GetDesiredVisualInfo(); v = this->GetDesiredVisualInfo();
if (!v)
{
vtkErrorMacro(<< "Could not find a decent visual\n");
abort();
}
this->ColorMap = XCreateColormap(this->DisplayId, this->ColorMap = XCreateColormap(this->DisplayId,
XRootWindow(this->DisplayId,v->screen), XRootWindow(this->DisplayId,v->screen),
v->visual, AllocNone); v->visual, AllocNone);
...@@ -537,8 +542,9 @@ void vtkXOpenGLRenderWindow::CreateAWindow() ...@@ -537,8 +542,9 @@ void vtkXOpenGLRenderWindow::CreateAWindow()
if (!this->Internal->FBConfig) if (!this->Internal->FBConfig)
{ {
int fbcount = 0; int fbcount = 0;
GLXFBConfig* fbc = GLXFBConfig* fbc = glXGetFBConfigs(this->DisplayId, matcher.screen, &fbcount);
glXGetFBConfigs(this->DisplayId, matcher.screen, &fbcount); if ( fbc )
{
int i; int i;
for (i=0; i<fbcount; ++i) for (i=0; i<fbcount; ++i)
{ {
...@@ -550,6 +556,7 @@ void vtkXOpenGLRenderWindow::CreateAWindow() ...@@ -550,6 +556,7 @@ void vtkXOpenGLRenderWindow::CreateAWindow()
} }
XFree(fbc); XFree(fbc);
} }
}
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment