summaryrefslogtreecommitdiffstats
path: root/src/inkscape.cpp
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2011-03-20 06:42:59 +0000
committerJon A. Cruz <jon@joncruz.org>2011-03-20 06:42:59 +0000
commit4e01c64b6094fa1f4bf63ec8a8f77cf21696b711 (patch)
tree8d6c7ae3f223f537457c55d3976d269772431eb9 /src/inkscape.cpp
parentFilters. Fix for Bug #737813 (translucent filter crashes program when resizin... (diff)
downloadinkscape-4e01c64b6094fa1f4bf63ec8a8f77cf21696b711.tar.gz
inkscape-4e01c64b6094fa1f4bf63ec8a8f77cf21696b711.zip
Cleaned up memory patch. Fixes bug #737298.
Fixed bugs: - https://launchpad.net/bugs/737298 (bzr r10118)
Diffstat (limited to 'src/inkscape.cpp')
-rw-r--r--src/inkscape.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/inkscape.cpp b/src/inkscape.cpp
index 430977567..1007c315a 100644
--- a/src/inkscape.cpp
+++ b/src/inkscape.cpp
@@ -875,23 +875,31 @@ gboolean inkscape_use_gui()
* Menus management
*
*/
-bool inkscape_load_menus (Inkscape::Application */*inkscape*/)
+bool inkscape_load_menus( Inkscape::Application * inkscape )
{
- // TODO fix that fn is being leaked
gchar *fn = profile_path(MENUS_FILE);
- gchar *menus_xml = NULL;
+ gchar *menus_xml = 0;
gsize len = 0;
- if (g_file_get_contents(fn, &menus_xml, &len, NULL)) {
+ if ( inkscape != inkscape_get_instance() ) {
+ g_warning("BAD BAD BAD THINGS");
+ }
+
+ if ( g_file_get_contents(fn, &menus_xml, &len, NULL) ) {
// load the menus_xml file
- INKSCAPE->menus = sp_repr_read_mem(menus_xml, len, NULL);
+ inkscape->menus = sp_repr_read_mem(menus_xml, len, NULL);
+
g_free(menus_xml);
- if (INKSCAPE->menus) {
- return true;
- }
+ menus_xml = 0;
}
- INKSCAPE->menus = sp_repr_read_mem(menus_skeleton, MENUS_SKELETON_SIZE, NULL);
- return (INKSCAPE->menus != 0);
+ g_free(fn);
+ fn = 0;
+
+ if ( !inkscape->menus ) {
+ inkscape->menus = sp_repr_read_mem(menus_skeleton, MENUS_SKELETON_SIZE, NULL);
+ }
+
+ return (inkscape->menus != 0);
}