summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a5d67c8)
raw | patch | inline | side by side (parent: a5d67c8)
author | tweenk <tweenk@users.sourceforge.net> | |
Thu, 26 Feb 2009 13:40:18 +0000 (13:40 +0000) | ||
committer | tweenk <tweenk@users.sourceforge.net> | |
Thu, 26 Feb 2009 13:40:18 +0000 (13:40 +0000) |
src/inkscape.cpp | patch | blob | history | |
src/preferences.cpp | patch | blob | history | |
src/preferences.h | patch | blob | history |
diff --git a/src/inkscape.cpp b/src/inkscape.cpp
index ae52589046ec1c34b5dbc2db3b156f4665fdc5a6..b497367cc999714f4283782aa93782a4bb57c3b7 100644 (file)
--- a/src/inkscape.cpp
+++ b/src/inkscape.cpp
new (&inkscape->document_set) std::map<SPDocument *, int>();
inkscape->menus = sp_repr_read_mem (_(menus_skeleton), MENUS_SKELETON_SIZE, NULL);
-
inkscape->desktops = NULL;
-
inkscape->dialogs_toggle = TRUE;
-
inkscape->mapalt=GDK_MOD1_MASK;
}
}
}
- Inkscape::Preferences::unload();
+ // do not save the preferences since they can be in a corrupted state
+ Inkscape::Preferences::unload(false);
fprintf (stderr, "Emergency save completed. Inkscape will close now.\n");
fprintf (stderr, "If you can reproduce this crash, please file a bug at www.inkscape.org\n");
inkscape->use_gui = use_gui;
inkscape->argv0 = g_strdup(argv0);
- /* Load the preferences and menus; Later menu layout should be merged into prefs */
+ /* Load the preferences and menus */
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->load(use_gui, false);
inkscape_load_menus(inkscape);
}
}
-
-
/*
Local Variables:
mode:c++
diff --git a/src/preferences.cpp b/src/preferences.cpp
index ea3c015efe380acd69fef666c5e1fdc3de27816b..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
@@ -637,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;
diff --git a/src/preferences.h b/src/preferences.h
index a87a2771813816d9ef0722559522784868949ea4..7335ab39a89022b081541d41f71bda9f4d21e375 100644 (file)
--- a/src/preferences.h
+++ b/src/preferences.h
return _instance;
}
/**
- * @brief Unload all preferences and store them on the hard disk.
+ * @brief Unload all preferences
+ * @param save Whether to save the preferences; defaults to true
*
- * This deletes the singleton object. Calling get() after this function is
- */
- static void unload() {
- if(_instance)
- {
- delete _instance;
- _instance = NULL;
- }
- }
+ * This deletes the singleton object. Calling get() after this function
+ * will reinstate it, so you shouldn't. Pass false as the parameter
+ * to suppress automatic saving.
+ */
+ static void unload(bool save=true);
/*@}*/
protected: