From 8a9d765739dc757eb7296b74bc8c912fa75f0000 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Sat, 7 Aug 2010 11:42:27 +0000 Subject: [PATCH] Bug #6842, part II Make sure that Package can be initialized several time.s Make sure that Package is not used before being initialized. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35080 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/LyX.cpp | 2 +- src/main.cpp | 3 --- src/support/Package.cpp | 10 ++-------- src/support/lassert.cpp | 2 +- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/LyX.cpp b/src/LyX.cpp index 3a03eb3145..5487339293 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -286,7 +286,7 @@ int LyX::exec(int & argc, char * argv[]) init_package(os::utf8_argv(0), string(), string(), top_build_dir_is_one_level_up); } catch (ExceptionMessage const & message) {} - Messages::init(); + locale_init(); // Here we need to parse the command line. At least // we need to parse for "-dbg" and "-help" diff --git a/src/main.cpp b/src/main.cpp index 5e09dd86fb..e9893062df 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -38,9 +38,6 @@ int main(int argc, char * argv[]) lyx::support::os::init(argc, argv); - // initialize for internationalized version *EK* - lyx::locale_init(); - lyx::LyX the_lyx_instance; return the_lyx_instance.exec(argc, argv); diff --git a/src/support/Package.cpp b/src/support/Package.cpp index d947f9ae80..b65bd1fd23 100644 --- a/src/support/Package.cpp +++ b/src/support/Package.cpp @@ -18,6 +18,7 @@ #include "support/ExceptionMessage.h" #include "support/filetools.h" #include "support/gettext.h" +#include "support/lassert.h" #include "support/lstrings.h" #include "support/os.h" @@ -56,10 +57,6 @@ void init_package(string const & command_line_arg0, string const & command_line_user_support_dir, exe_build_dir_to_top_build_dir top_build_dir_location) { - // Can do so only once. - if (initialised_) - return; - package_ = Package(command_line_arg0, command_line_system_support_dir, command_line_user_support_dir, @@ -70,10 +67,7 @@ void init_package(string const & command_line_arg0, Package const & package() { - // Commented out because package().locale_dir() can be called - // from the message translation code in Messages.cpp before - // init_package() is called. Lars is on the case... - // LASSERT(initialised_, /**/); + LASSERT(initialised_, /**/); return package_; } diff --git a/src/support/lassert.cpp b/src/support/lassert.cpp index 1e6cd55ecf..b384007f60 100644 --- a/src/support/lassert.cpp +++ b/src/support/lassert.cpp @@ -1,5 +1,5 @@ /** - * \file assert.cpp + * \file lassert.cpp * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * -- 2.39.2