From 2a57bc9cdc125d8997f60e04de8410a5ef82525c Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Mon, 23 Aug 2010 18:15:01 +0200 Subject: - Fix potential singleton memory deallocation problems - Fix ¨mysql_global_end() 1 thread didn´t exit¨ error Author: Derex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : trunk --- src/server/worldserver/CommandLine/CliRunnable.cpp | 9 +++++++++ src/server/worldserver/Main.cpp | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index 01f2a2985c1..ef114e87467 100644 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -83,6 +83,14 @@ char ** cli_completion(const char * text, int start, int /*end*/) rl_bind_key('\t',rl_abort); return (matches); } + +int cli_hook_func(void) +{ + if (World::IsStopped()) + rl_done = 1; + return 0; +} + #endif void utf8print(void* /*arg*/, const char* str) @@ -717,6 +725,7 @@ void CliRunnable::run() //sLog.outString(""); #if PLATFORM != WINDOWS rl_attempted_completion_function = cli_completion; + rl_event_hook = cli_hook_func; #endif if (sConfig.GetBoolDefault("BeepAtStart", true)) printf("\a"); // \a = Alert diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 71fd88ce7df..fd6ecdda8fa 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -74,6 +74,8 @@ void usage(const char *prog) /// Launch the Trinity server extern int main(int argc, char **argv) { + ACE::init(); + ///- Command line parsing to get the configuration file name char const* cfg_file = _TRINITY_CORE_CONFIG; int c=1; @@ -144,12 +146,16 @@ extern int main(int argc, char **argv) ///- and run the 'Master' /// \todo Why do we need this 'Master'? Can't all of this be in the Main as for Realmd? - return sMaster.Run(); + int ret = sMaster.Run(); // at sMaster return function exist with codes // 0 - normal shutdown // 1 - shutdown at error // 2 - restart command used, this code can be used by restarter for restart Trinityd + + ACE::fini(); + + return ret; } /// @} -- cgit v1.2.3