diff --git a/src/preferences.cpp b/src/preferences.cpp
index 76edc2f7c54c7d2ae9c3dbaa312166d154cc874a..16b775b345243e21d1691ce0e76404dceb93354e 100644 (file)
--- a/src/preferences.cpp
+++ b/src/preferences.cpp
}
Preferences::~Preferences()
-{
- // when the preferences are unloaded, save them
- save();
-
+{
// delete all PrefNodeObservers
for (_ObsMap::iterator i = _observer_map.begin(); i != _observer_map.end(); ) {
delete (*i++).second; // avoids reference to a deleted key
@@ -489,7 +486,8 @@ Inkscape::XML::Node *Preferences::_getNode(Glib::ustring const &pref_key, bool c
{
// verify path
g_assert( pref_key.at(0) == '/' );
- g_assert( pref_key.find('.') == Glib::ustring::npos );
+ // No longer necessary, can cause problems with input devices which have a dot in the name
+ // g_assert( pref_key.find('.') == Glib::ustring::npos );
Inkscape::XML::Node *node = _prefs_doc->root(), *child = NULL;
gchar **splits = g_strsplit(pref_key.data(), "/", 0);
@@ -636,6 +634,16 @@ Preferences::Entry const Preferences::_create_pref_value(Glib::ustring const &pa
return Entry(path, ptr);
}
+void Preferences::unload(bool save)
+{
+ if(_instance)
+ {
+ if (save) _instance->save();
+ delete _instance;
+ _instance = NULL;
+ }
+}
+
Preferences *Preferences::_instance = NULL;