Browse Source

pgraph: fix LightLensNode assert due to bad refcount in LightAttrib::compose

rdb 8 years ago
parent
commit
51090ccf12
1 changed files with 8 additions and 0 deletions
  1. 8 0
      panda/src/pgraph/lightAttrib.cxx

+ 8 - 0
panda/src/pgraph/lightAttrib.cxx

@@ -833,6 +833,14 @@ compose_impl(const RenderAttrib *other) const {
     ++result;
   }
 
+  // Increase the attrib_ref of all the lights in this new attribute.
+  Lights::const_iterator it;
+  for (it = new_attrib->_on_lights.begin(); it != new_attrib->_on_lights.end(); ++it) {
+    Light *lobj = (*it).node()->as_light();
+    nassertd(lobj != nullptr) continue;
+    lobj->attrib_ref();
+  }
+
   return return_new(new_attrib);
 }