From a51385827276535559541fb2e4c5145876a7d08a Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 30 Aug 2012 09:22:17 +0900 Subject: Fix for 170550 : open blank document on 'close' (bzr r11632) --- src/file.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index fd039323b..3b24876c4 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -145,7 +145,7 @@ SPDesktop *sp_file_new(const Glib::ustring &templ) return dt; } -SPDesktop* sp_file_new_default() +Glib::ustring sp_file_default_template_uri() { std::list sources; sources.push_back( profile_path("templates") ); // first try user's local dir @@ -181,12 +181,22 @@ SPDesktop* sp_file_new_default() g_free(*it); } - SPDesktop* desk = sp_file_new(foundTemplate ? foundTemplate : ""); + Glib::ustring templateUri = foundTemplate ? foundTemplate : ""; + if (foundTemplate) { g_free(foundTemplate); foundTemplate = 0; } + + return templateUri; +} + +SPDesktop* sp_file_new_default() +{ + Glib::ustring templateUri = sp_file_default_template_uri(); + SPDesktop* desk = sp_file_new(sp_file_default_template_uri()); rdf_add_from_preferences( SP_ACTIVE_DOCUMENT ); + return desk; } -- cgit v1.2.3