diff mbox

[Branch,~glmark2-dev/glmark2/trunk] Rev 275: CanvasGeneric: Check buffer object handles before calling delete. While it is

Message ID 20130611224417.31054.28680.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Jesse Barker June 11, 2013, 10:44 p.m. UTC
------------------------------------------------------------
revno: 275
committer: Jesse Barker <jesse.barker@linaro.org>
branch nick: trunk
timestamp: Tue 2013-06-11 15:40:02 -0700
message:
  CanvasGeneric: Check buffer object handles before calling delete.  While it is
  perfectly legal and harmless to delete an object handle of zero, there are
  times when we do this before having made a context current, which _should_ be
  harmless (because implementations don't like to crash), but it not really cool.
modified:
  src/canvas-generic.cpp


--
lp:glmark2
https://code.launchpad.net/~glmark2-dev/glmark2/trunk

You are subscribed to branch lp:glmark2.
To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'src/canvas-generic.cpp'
--- src/canvas-generic.cpp	2013-03-04 19:07:07 +0000
+++ src/canvas-generic.cpp	2013-06-11 22:40:02 +0000
@@ -409,12 +409,18 @@ 
 void
 CanvasGeneric::release_fbo()
 {
-    glDeleteFramebuffers(1, &fbo_);
-    glDeleteRenderbuffers(1, &color_renderbuffer_);
-    glDeleteRenderbuffers(1, &depth_renderbuffer_);
-    fbo_ = 0;
-    color_renderbuffer_ = 0;
-    depth_renderbuffer_ = 0;
+    if (fbo_) {
+        glDeleteFramebuffers(1, &fbo_);
+        fbo_ = 0;
+    }
+    if (!color_renderbuffer_) {
+        glDeleteRenderbuffers(1, &color_renderbuffer_);
+        color_renderbuffer_ = 0;
+    }
+    if (!depth_renderbuffer_) {
+        glDeleteRenderbuffers(1, &depth_renderbuffer_);
+        depth_renderbuffer_ = 0;
+    }
 
     gl_color_format_ = 0;
     gl_depth_format_ = 0;