From e8724884d0adde5879adc62acbad7a06a88f6b5b Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 1 Jul 2014 11:03:55 +0200 Subject: [PATCH] + add further log messages at startup for better troubleshooting, fix possible crash, fix typos --- src/App/Application.cpp | 5 +++-- src/Base/UnitsApi.cpp | 5 ++++- src/Gui/Application.cpp | 1 + src/Main/FreeCADGuiPy.cpp | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 57ac5ebec..5e430e3fd 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -922,7 +922,7 @@ void segmentation_fault_handler(int sig) switch (sig) { case SIGSEGV: std::cerr << "Illegal storage access..." << std::endl; - throw Base::Exception("Illegal storage access! Please save you work under a new file name and restart the application!"); + throw Base::Exception("Illegal storage access! Please save your work under a new file name and restart the application!"); break; case SIGABRT: std::cerr << "Abnormal program termination..." << std::endl; @@ -945,7 +945,7 @@ void unexpection_error_handler() { std::cerr << "Unexpected error occurred..." << std::endl; // try to throw to give the user evantually a change to save - throw Base::Exception("Unexpected error occurred! Please save you work under a new file name and restart the application!"); + throw Base::Exception("Unexpected error occurred! Please save your work under a new file name and restart the application!"); terminate(); } @@ -1207,6 +1207,7 @@ void Application::initApplication(void) UnitsApi::setSchema((UnitSystem)hGrp->GetInt("UserSchema",0)); // starting the init script + Console().Log("Run App init script\n"); Interpreter().runString(Base::ScriptFactory().ProduceScript("FreeCADInit")); } diff --git a/src/Base/UnitsApi.cpp b/src/Base/UnitsApi.cpp index 20e460b66..4317153da 100644 --- a/src/Base/UnitsApi.cpp +++ b/src/Base/UnitsApi.cpp @@ -80,16 +80,19 @@ UnitsApi::~UnitsApi() void UnitsApi::setSchema(UnitSystem s) { - if(UserPrefSystem){ + if (UserPrefSystem) { UserPrefSystem->resetSchemaUnits(); // for schemas changed the Quantity constants delete UserPrefSystem; + UserPrefSystem = 0; } switch (s) { case SI1 : UserPrefSystem = new UnitsSchemaInternal(); break; case SI2 : UserPrefSystem = new UnitsSchemaMKS(); break; case Imperial1: UserPrefSystem = new UnitsSchemaImperial1(); break; case ImperialDecimal: UserPrefSystem = new UnitsSchemaImperialDecimal(); break; + default : UserPrefSystem = new UnitsSchemaInternal(); s = SI1; break; } + actSystem = s; UserPrefSystem->setSchemaUnits(); // if necesarry a unit schema can change the constants in Quantity (e.g. mi=1.8km rather then 1.6km). } diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index e9e4fd6f8..12a383f16 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -1701,6 +1701,7 @@ void Application::runApplication(void) // running the GUI init script try { + Base::Console().Log("Run Gui init script\n"); Base::Interpreter().runString(Base::ScriptFactory().ProduceScript("FreeCADGuiInit")); } catch (const Base::Exception& e) { diff --git a/src/Main/FreeCADGuiPy.cpp b/src/Main/FreeCADGuiPy.cpp index 7a19da8f9..25f33e416 100644 --- a/src/Main/FreeCADGuiPy.cpp +++ b/src/Main/FreeCADGuiPy.cpp @@ -267,6 +267,7 @@ QWidget* setupMainWindow() static bool init = false; if (!init) { try { + Base::Console().Log("Run Gui init script\n"); Base::Interpreter().runString(Base::ScriptFactory().ProduceScript("FreeCADGuiInit")); } catch (const Base::Exception& e) {