summaryrefslogtreecommitdiff
path: root/gtk2_ardour/template_dialog.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-09-22 17:16:04 +0200
committerRobin Gareus <robin@gareus.org>2017-09-22 17:16:04 +0200
commit969e941854dd6e6d74da21cbc80b48c1a49899de (patch)
tree2d401787557123c6533a4a3d881f7e54f8497c06 /gtk2_ardour/template_dialog.cc
parentaac8040e95bbecd67156a567c67640049484ef3a (diff)
Fix issue with Template manager deleting templates on no-rename
If old-name equals new-name, g_rename () will fail and cleanup will delete new-path (which is equal to old-path)
Diffstat (limited to 'gtk2_ardour/template_dialog.cc')
-rw-r--r--gtk2_ardour/template_dialog.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/gtk2_ardour/template_dialog.cc b/gtk2_ardour/template_dialog.cc
index e503be74a9..d71125bef7 100644
--- a/gtk2_ardour/template_dialog.cc
+++ b/gtk2_ardour/template_dialog.cc
@@ -708,6 +708,10 @@ SessionTemplateManager::rename_template (TreeModel::iterator& item, const Glib::
const string old_name = item->get_value (_template_columns.name);
const string new_name = string (new_name_);
+ if (old_name == new_name) {
+ return;
+ }
+
const string old_file_old_path = Glib::build_filename (old_path, old_name+".template");
XMLTree tree;
@@ -812,6 +816,10 @@ RouteTemplateManager::rename_template (TreeModel::iterator& item, const Glib::us
const string old_filepath = item->get_value (_template_columns.path);
const string new_filepath = Glib::build_filename (user_route_template_directory(), new_name+".template");
+ if (old_name == new_name) {
+ return;
+ }
+
XMLTree tree;
if (!tree.read (old_filepath)) {
error << string_compose (_("Could not parse template file \"%1\"."), old_filepath) << endmsg;