changeset 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 8018e10d2b87
children bcacdcc726f7
files src/ChangeLog src/gl-render.cc
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Jul 09 10:58:12 2008 -0400
+++ b/src/ChangeLog	Wed Jul 09 10:59:29 2008 -0400
@@ -1,3 +1,9 @@
+2008-07-09  Michael Goffioul  <michael.goffioul@gmail.com>
+
+	* gl-render.cc (vertex_data::vertex_data_rep::vertex_data(void),
+	vertex_data::vertex_data(void), vertex_data::vertex_data(...)):
+	initialize reference counting correctly.
+
 2008-07-09  John W. Eaton  <jwe@octave.org>
 
 	* toplev.cc (main_loop): Unwind-protect global_command.
--- 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) { }