From 360f0bbaa2e05cc696e7df8bc201b0abe37f9117 Mon Sep 17 00:00:00 2001 From: David Rose Date: Sat, 23 Apr 2005 00:09:04 +0000 Subject: [PATCH] finalize order properly --- panda/src/gobj/qpgeom.cxx | 8 ++++++++ panda/src/gobj/qpgeomVertexData.cxx | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/panda/src/gobj/qpgeom.cxx b/panda/src/gobj/qpgeom.cxx index ebd7993352..ed98d28273 100644 --- a/panda/src/gobj/qpgeom.cxx +++ b/panda/src/gobj/qpgeom.cxx @@ -1047,6 +1047,14 @@ make_from_bam(const FactoryParams ¶ms) { 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); } diff --git a/panda/src/gobj/qpgeomVertexData.cxx b/panda/src/gobj/qpgeomVertexData.cxx index 0b91d7b6e0..5bf44be578 100644 --- a/panda/src/gobj/qpgeomVertexData.cxx +++ b/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