Fixed crash while shutting down Icinga.

This commit is contained in:
Gunnar Beutner 2012-08-14 14:04:05 +02:00
parent 160219f4d3
commit 06b1a73864
2 changed files with 5 additions and 6 deletions

View File

@ -69,8 +69,6 @@ Application::~Application(void)
m_ShuttingDown = true;
DynamicObject::DeactivateObjects();
#ifdef _WIN32
WSACleanup();
#endif /* _WIN32 */
@ -300,8 +298,6 @@ int Application::Run(int argc, char **argv)
DynamicObject::FinishTx();
DynamicObject::DeactivateObjects();
assert(m_Instance == NULL);
} catch (const exception& ex) {
Logger::Write(LogCritical, "base", "---");
Logger::Write(LogCritical, "base", "Exception: " + Utility::GetTypeName(typeid(ex)));

View File

@ -45,6 +45,8 @@ int main(int argc, char **argv)
lt_dlinit();
#endif /* _WIN32 */
/* This must be done before calling any other functions
* in the base library. */
Application::SetMainThread();
#ifdef _WIN32
@ -60,14 +62,13 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
String configFile = argv[2];
String componentDirectory = Utility::DirName(Application::GetExePath(argv[0])) + "/../lib/icinga2";
Component::AddSearchDir(componentDirectory);
DynamicObject::BeginTx();
/* load config file */
String configFile = argv[2];
vector<ConfigItem::Ptr> configItems = ConfigCompiler::CompileFile(configFile);
Logger::Write(LogInformation, "icinga", "Executing config items...");
@ -83,6 +84,8 @@ int main(int argc, char **argv)
if (!app)
throw_exception(runtime_error("Configuration must create an Application object."));
/* The application class doesn't need to know about the "-c configFile"
* command-line arguments. */
return app->Run(argc - 2, &(argv[2]));
}