Messages::init(); needs Package. this fixes a crash on windows which presents parsing of the argument

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38139 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2011-03-29 22:18:21 +00:00
parent b391929ece
commit 97a5c0882d
4 changed files with 12 additions and 2 deletions

View File

@ -295,7 +295,6 @@ int LyX::exec(int & argc, char * argv[])
} catch (ExceptionMessage const & message) {
LYXERR(Debug::LOCALE, message.title_ + ", " + message.details_);
}
// FIXME: This breaks out of source build under Windows.
locale_init();
// Here we need to parse the command line. At least

View File

@ -65,6 +65,12 @@ void init_package(string const & command_line_arg0,
}
bool packageInitialized()
{
return initialised_;
}
Package const & package()
{
LASSERT(initialised_, /**/);

View File

@ -52,6 +52,8 @@ void init_package(std::string const & command_line_arg0,
std::string const & command_line_user_support_dir,
exe_build_dir_to_top_build_dir);
bool packageInitialized();
/** Accessor to the global data.
* Asserts that init_package() has been called first.
*/

View File

@ -15,6 +15,7 @@
#include "support/lstrings.h"
#include "support/Messages.h"
#include "support/Package.h"
#ifdef HAVE_LOCALE_H
# include <locale.h>
@ -37,7 +38,9 @@ void locale_init()
setlocale(LC_MESSAGES, "");
# endif
setlocale(LC_CTYPE, "");
Messages::init();
if (support::packageInitialized()) {
Messages::init();
}
#endif
setlocale(LC_NUMERIC, "C");
}