Fixed #102 (Potential issue while upgrading from .25.1 to .25.2)

The reason was that for 0.25.1 "macro-editor-font-size" was allowed
to be an empty string (the default). Which meant: take default application
font size. In 0.25.2 this now was required to be a number and 0 was
the default for "auto" font size.

Two changes:
 - The default is back to empty string ("0" is still allowed as default)
 - The application was made safe against broken configuration files: an
   error is printed to the log, but apart from that the application
   will work (the configuration value is ignored however).
This commit is contained in:
Matthias Koefferlein
2018-03-20 18:52:00 +01:00
parent 19f25cc90b
commit 21e2af2a97
2 changed files with 19 additions and 7 deletions
+15 -5
View File
@@ -27,6 +27,7 @@
#include "tlException.h"
#include "tlAssert.h"
#include "tlXMLParser.h"
#include "tlLog.h"
#include "layPlugin.h"
#include "tlExceptions.h"
@@ -37,6 +38,7 @@
#include <iostream>
#include <fstream>
#include <memory>
#include <QObject>
namespace lay
{
@@ -293,8 +295,12 @@ Plugin::config_set (const std::string &name, const std::string &value)
// look for plugins that receive that configuration statically if the root is addressed
if (! mp_parent && ! m_standalone) {
for (tl::Registrar<lay::PluginDeclaration>::iterator cls = tl::Registrar<lay::PluginDeclaration>::begin (); cls != tl::Registrar<lay::PluginDeclaration>::end (); ++cls) {
if ((const_cast<lay::PluginDeclaration *> (&*cls))->configure (name, value)) {
return;
try {
if ((const_cast<lay::PluginDeclaration *> (&*cls))->configure (name, value)) {
return;
}
} catch (tl::Exception &ex) {
tl::error << tl::to_string (QObject::tr ("Error on configure")) << " " << name << "='" << value << "': " << ex.msg ();
}
}
}
@@ -381,9 +387,13 @@ Plugin::do_config_end ()
bool
Plugin::do_config_set (const std::string &name, const std::string &value)
{
if (configure (name, value)) {
// taken by us - don't propagate to the children
return true;
try {
if (configure (name, value)) {
// taken by us - don't propagate to the children
return true;
}
} catch (tl::Exception &ex) {
tl::error << tl::to_string (QObject::tr ("Error on configure")) << " " << name << "='" << value << "': " << ex.msg ();
}
// propagate to all children (not only the first that takes it!)