From: José Fonseca Date: Wed, 24 Oct 2012 15:42:22 +0000 (+0100) Subject: Fix current context tracking. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=f74ad0d7b108d0b628e2290a4b6c597e9a13ee8e;p=apitrace Fix current context tracking. --- diff --git a/retrace/glretrace_main.cpp b/retrace/glretrace_main.cpp index bd5378a..5ccb2e2 100755 --- a/retrace/glretrace_main.cpp +++ b/retrace/glretrace_main.cpp @@ -319,6 +319,7 @@ frame_complete(trace::Call &call) { return; } + assert(currentContext->drawable); if (retrace::debug && !currentContext->drawable->visible) { retrace::warning(call) << "could not infer drawable size (glViewport never called)\n"; } @@ -434,8 +435,11 @@ retrace::dumpState(std::ostream &os) void retrace::flushRendering(void) { - glretrace::flushQueries(); - glFlush(); + glretrace::Context *currentContext = glretrace::getCurrentContext(); + if (currentContext) { + glretrace::flushQueries(); + glFlush(); + } } void diff --git a/retrace/glretrace_ws.cpp b/retrace/glretrace_ws.cpp index d4b0817..5ae908f 100644 --- a/retrace/glretrace_ws.cpp +++ b/retrace/glretrace_ws.cpp @@ -156,10 +156,10 @@ makeCurrent(trace::Call &call, glws::Drawable *drawable, Context *context) if (currentContext) { currentContext->drawable = NULL; } + currentContextPtr = context; if (drawable && context) { context->drawable = drawable; - currentContextPtr = context; if (!context->used) { initContext();