Browse Source

finalize order properly

David Rose 20 years ago
parent
commit
360f0bbaa2
2 changed files with 12 additions and 0 deletions
  1. 8 0
      panda/src/gobj/qpgeom.cxx
  2. 4 0
      panda/src/gobj/qpgeomVertexData.cxx

+ 8 - 0
panda/src/gobj/qpgeom.cxx

@@ -1047,6 +1047,14 @@ make_from_bam(const FactoryParams &params) {
 void qpGeom::
 finalize(BamReader *manager) {
   CDWriter cdata(_cycler);
+
+  // Make sure our GeomVertexData is finalized first.  This may result
+  // in the data getting finalized multiple times, but it doesn't mind
+  // that.
+  if (cdata->_data != (qpGeomVertexData *)NULL) {
+    cdata->_data->finalize(manager);
+  }
+
   reset_geom_rendering(cdata);
 }
 

+ 4 - 0
panda/src/gobj/qpgeomVertexData.cxx

@@ -1533,6 +1533,10 @@ complete_pointers(TypedWritable **p_list, BamReader *manager) {
 ////////////////////////////////////////////////////////////////////
 void qpGeomVertexData::
 finalize(BamReader *manager) {
+  // NOTE: This method may be called more than once, because the
+  // Geom::finalize() will call it explicitly.  We have to be prepared
+  // to accept multiple finalize() calls.
+
   // Now we need to register the format that we have read from the bam
   // file (since it doesn't come out of the bam file automatically
   // registered).  This may change the format's pointer, which we