- Code: Select all
#define VERBOSE 1
#if (VERBOSE)
#define INFO(STR) MessageInterface::ShowMessage(STR)
#define INFO1(STR, VAR1) MessageInterface::ShowMessage(STR,VAR1)
#else
#define INFO(STR)
#define INFO(STR, VAR1)
#endif
JavaizeFactory::JavaizeFactory() : Factory(Gmat::COMMAND) {
INFO("Entering JavaizeFactory no-arg constructor.\n");
INFO1("creatables is empty? Answer = %d\n", creatables.empty());
if (creatables.empty()) {
INFO("\tEntered pushback block.\n");
creatables.push_back("Javaize");
INFO("\tLeaving pushback block.\n");
}
INFO("Leaving JavaizeFactory no-arg constructor.\n");
}
This crashes GMAT. When I run through the console version (having defined DEBUG_PLUGIN_REGISTRATION in Moderator.cpp to get additional trace), the last message that I get is "Entered pushback block." and then some error messages from GMAT:
Unknown Error occurred during initialization
Moderator failed to initialize! Unable to run GmatConsole.
Sometimes I also get a Segmentation Fault message at the end, but this is not reproducible.
I'm at a loss for what's happening here. Has anyone seen such a thing before? I have not dug deeply into the parent class's constructor to see what it does to creatables before my constructor runs, but the line of the apparent crash is just a call to an STL method, and the call to empty already worked, so the variable is initialized. If I comment out the push_back line, GMAT runs all the way through initialization, although GMAT in that case reports no object types for this factory. I'm using MS Visual C++ on a 64-bit Windows machine. My configuration is Debug and Win32.