Merge "When disconnecting a surface, cancel don't queue the buffer" into jb-mr2-dev
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp
index bc1cf36..0ed5727 100644
--- a/opengl/libagl/egl.cpp
+++ b/opengl/libagl/egl.cpp
@@ -420,9 +420,8 @@
         bits = NULL;
         unlock(buffer);
     }
-    // enqueue the last frame
-    nativeWindow->queueBuffer(nativeWindow, buffer, -1);
     if (buffer) {
+        nativeWindow->cancelBuffer(nativeWindow, buffer, -1);
         buffer->common.decRef(&buffer->common);
         buffer = 0;
     }