fix static init loop

This commit is contained in:
David Rose 2008-09-19 19:20:37 +00:00
parent 8b0461fadd
commit d7ec4a0fce
2 changed files with 10 additions and 4 deletions

View File

@ -20,7 +20,7 @@
ModelPool *ModelPool::_global_ptr = (ModelPool *)NULL;
static Loader model_loader;
static Loader *model_loader = NULL;
////////////////////////////////////////////////////////////////////
// Function: ModelPool::write
@ -73,7 +73,10 @@ ns_load_model(const string &filename, const LoaderOptions &options) {
new_options.set_flags((new_options.get_flags() | LoaderOptions::LF_no_ram_cache) &
~(LoaderOptions::LF_search | LoaderOptions::LF_report_errors));
PT(PandaNode) panda_node = model_loader.load_sync(filename, new_options);
if (model_loader == (Loader *)NULL) {
model_loader = new Loader("ModelPool", 0);
}
PT(PandaNode) panda_node = model_loader->load_sync(filename, new_options);
PT(ModelRoot) node;
if (panda_node.is_null()) {

View File

@ -24,7 +24,7 @@
FontPool *FontPool::_global_ptr = (FontPool *)NULL;
static Loader model_loader;
static Loader *model_loader = NULL;
////////////////////////////////////////////////////////////////////
// Function: FontPool::write
@ -94,7 +94,10 @@ ns_load_font(const string &str) {
string extension = filename.get_extension();
if (extension.empty() || extension == "egg" || extension == "bam") {
PT(PandaNode) node = model_loader.load_sync(filename);
if (model_loader == (Loader *)NULL) {
model_loader = new Loader("FontPool", 0);
}
PT(PandaNode) node = model_loader->load_sync(filename);
if (node != (PandaNode *)NULL) {
// It is a model. Elevate all the priorities by 1, and make a
// font out of it.