summaryrefslogtreecommitdiff
path: root/retrace
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2015-12-20 00:30:45 +0000
committerJose Fonseca <jfonseca@vmware.com>2015-12-20 00:30:45 +0000
commit83032cb35d4a84ba28b3e829feae3f697d13f0b3 (patch)
tree21c09c77b801be2232168d8065215cde255f9a3e /retrace
parent84e644fc7bb99f865374b55e13b36c6760148e53 (diff)
glretrace: Handle make current with null drawable.
Fixes https://github.com/apitrace/apitrace/issues/402
Diffstat (limited to 'retrace')
-rw-r--r--retrace/glretrace_ws.cpp4
-rw-r--r--retrace/glws_glx.cpp16
2 files changed, 13 insertions, 7 deletions
diff --git a/retrace/glretrace_ws.cpp b/retrace/glretrace_ws.cpp
index 4d617f74..cfac4f55 100644
--- a/retrace/glretrace_ws.cpp
+++ b/retrace/glretrace_ws.cpp
@@ -203,7 +203,9 @@ updateDrawable(int width, int height) {
}
glws::Drawable *currentDrawable = currentContext->drawable;
- assert(currentDrawable);
+ if (!currentDrawable) {
+ return;
+ }
if (currentDrawable->pbuffer) {
return;
diff --git a/retrace/glws_glx.cpp b/retrace/glws_glx.cpp
index daec4851..a2d5b3a4 100644
--- a/retrace/glws_glx.cpp
+++ b/retrace/glws_glx.cpp
@@ -359,16 +359,20 @@ createContext(const Visual *_visual, Context *shareContext, bool debug)
bool
makeCurrentInternal(Drawable *drawable, Context *context)
{
- if (!drawable || !context) {
- return glXMakeCurrent(display, None, NULL);
- } else {
+ Window draw = None;
+ if (drawable) {
GlxDrawable *glxDrawable = static_cast<GlxDrawable *>(drawable);
- GlxContext *glxContext = static_cast<GlxContext *>(context);
-
glxDrawable->ever_current = true;
+ draw = glxDrawable->window;
+ }
- return glXMakeCurrent(display, glxDrawable->window, glxContext->context);
+ GLXContext ctx = nullptr;
+ if (context) {
+ GlxContext *glxContext = static_cast<GlxContext *>(context);
+ ctx = glxContext->context;
}
+
+ return glXMakeCurrent(display, draw, ctx);
}
Window