diff src/gl-render.cc @ 7904:1fddd9b8e862

Fix nil_rep reference counting in gl-render.cc::vertex_data internal class
author John W. Eaton <jwe@octave.org>
date Wed, 09 Jul 2008 10:59:29 -0400
parents e3a502930e2a
children b3becd212f3f
line wrap: on
line diff
--- a/src/gl-render.cc	Wed Jul 09 10:58:12 2008 -0400
+++ b/src/gl-render.cc	Wed Jul 09 10:59:29 2008 -0400
@@ -326,7 +326,7 @@
     // reference counter
     int count;
 
-    vertex_data_rep (void) { }
+    vertex_data_rep (void) : count (1) { }
 
     vertex_data_rep (const Matrix& c, const Matrix& col, const Matrix& n,
 		     double a, float as, float ds, float ss, float se)
@@ -346,7 +346,8 @@
     }
 
 public:
-  vertex_data (void) : rep (nil_rep ()) { }
+  vertex_data (void) : rep (nil_rep ())
+    { rep->count++; }
 
   vertex_data (const vertex_data& v) : rep (v.rep)
     { rep->count++; }
@@ -354,9 +355,7 @@
   vertex_data (const Matrix& c, const Matrix& col, const Matrix& n,
 	       double a, float as, float ds, float ss, float se)
       : rep (new vertex_data_rep (c, col, n, a, as, ds, ss, se))
-    {
-      rep->count++;
-    }
+    { }
 
   vertex_data (vertex_data_rep *new_rep)
       : rep (new_rep) { }