Browse Source

Fix use of uninitialized variable pointed out by valgrind

rdb 9 years ago
parent
commit
cccd29cc61
1 changed files with 12 additions and 4 deletions
  1. 12 4
      panda/src/pipeline/pipeline.cxx

+ 12 - 4
panda/src/pipeline/pipeline.cxx

@@ -27,13 +27,15 @@ Pipeline *Pipeline::_render_pipeline = (Pipeline *)NULL;
 ////////////////////////////////////////////////////////////////////
 Pipeline::
 Pipeline(const string &name, int num_stages) :
-  Namable(name)
+  Namable(name),
 #ifdef THREADED_PIPELINE
-  , _lock("Pipeline")
+  _num_stages(num_stages),
+  _lock("Pipeline")
+#else
+  _num_stages(1)
 #endif
 {
 #ifdef THREADED_PIPELINE
-
   // We maintain all of the cyclers in the world on one of two linked
   // lists.  Cyclers that are "clean", which is to say, they have the
   // same value across all pipeline stages, are stored on the _clean
@@ -56,9 +58,15 @@ Pipeline(const string &name, int num_stages) :
   // This flag is true only during the call to cycle().
   _cycling = false;
 
+#else
+  if (num_stages != 1) {
+    pipeline_cat.warning()
+      << "Requested " << num_stages
+      << " pipeline stages but multithreaded render pipelines not enabled in build.\n";
+  }
 #endif  // THREADED_PIPELINE
 
-  set_num_stages(num_stages);
+  nassertv(num_stages >= 1);
 }
 
 ////////////////////////////////////////////////////////////////////