From 27696d9c7fc964cc5e4f79eb3c9465151ba39efc Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 2 Apr 2016 15:46:14 +0200 Subject: [PATCH] Handle GL attribList being NULL - use a default attrib list of { 0 } --- renderdoc/driver/gl/gl_hooks_linux.cpp | 6 ++++-- renderdoc/driver/gl/gl_hooks_win32.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/renderdoc/driver/gl/gl_hooks_linux.cpp b/renderdoc/driver/gl/gl_hooks_linux.cpp index d788fd5de..2998f6ebe 100644 --- a/renderdoc/driver/gl/gl_hooks_linux.cpp +++ b/renderdoc/driver/gl/gl_hooks_linux.cpp @@ -629,14 +629,16 @@ void glXDestroyContext(Display *dpy, GLXContext ctx) __attribute__ ((visibility ("default"))) GLXContext glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config, GLXContext shareList, Bool direct, const int *attribList) { - const int *attribs = attribList; + int defaultAttribList[] = { 0 }; + + const int *attribs = attribList ? attribList : defaultAttribList; vector attribVec; // modify attribs to our liking { bool flagsNext = false; bool flagsFound = false; - const int *a = attribList; + const int *a = attribs; while(*a) { int val = *a; diff --git a/renderdoc/driver/gl/gl_hooks_win32.cpp b/renderdoc/driver/gl/gl_hooks_win32.cpp index 850d83cd3..b390adf4f 100644 --- a/renderdoc/driver/gl/gl_hooks_win32.cpp +++ b/renderdoc/driver/gl/gl_hooks_win32.cpp @@ -452,14 +452,16 @@ class OpenGLHook : LibraryHook glhooks.m_CreatingContext = true; - const int *attribs = attribList; + int defaultAttribList[] = { 0 }; + + const int *attribs = attribList ? attribList : defaultAttribList; vector attribVec; // modify attribs to our liking { bool flagsNext = false; bool flagsFound = false; - const int *a = attribList; + const int *a = attribs; while(*a) { int val = *a;