Commit 90f09635 authored by Eloi Gaudry's avatar Eloi Gaudry
Browse files

Segfault in create awindow

there are some paths in the vtkXOpenGLRenderWindow (CreateAWindow for instance) that would need better NULL pointer check to avoid SEGFAULT and allow a clean abort.
this fix should also be merged to the release branch
parent 149919e1
...@@ -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);
......
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