summaryrefslogtreecommitdiff
path: root/tests/glean/tbinding.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/glean/tbinding.cpp')
-rw-r--r--tests/glean/tbinding.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/glean/tbinding.cpp b/tests/glean/tbinding.cpp
index 6aedd0253..c73cfae48 100644
--- a/tests/glean/tbinding.cpp
+++ b/tests/glean/tbinding.cpp
@@ -88,7 +88,6 @@ MakeCurrentTest::runOne(MakeCurrentResult& r, Window& w) {
// The rendering contexts to be used:
vector<RenderingContext*> rcs;
- // Short descriptions of the rendering contexts:
RandomBitsDouble rRand(config.r, 712105);
RandomBitsDouble gRand(config.g, 63230);
@@ -153,8 +152,24 @@ failed:
r.pass = false;
cleanup:
for (i = 0; i < static_cast<int>(rcs.size()); ++i)
- if (rcs[i])
+ if (rcs[i]) {
+ // We need to make sure that no GL commands are
+ // pending when the window is destroyed, or we
+ // risk a GLXBadCurrentWindow error at some
+ // indeterminate time in the future when
+ // glXMakeCurrent() is executed.
+ // In theory, if glReadPixels() is the last
+ // command executed by a test, then an implicit
+ // flush has occurred, and the command queue is
+ // empty. In practice, we have to protect
+ // against the possibility that the implicit
+ // flush is not enough to avoid the error.
+ ws.makeCurrent(*rcs[i], w);
+ glFinish();
+ ws.makeCurrent();
+
delete rcs[i];
+ }
} // MakeCurrentTest::runOne
///////////////////////////////////////////////////////////////////////////////