From 823fab41a48e38cd74c5bd317d8087dc7b283a43 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sat, 11 Nov 2017 10:39:45 -0500 Subject: mq_profiles_remove(): Don't remove the current profile A process that removes its own running profile can't restore it. mq_profiles_remove() removes a profile's group from the key file. The file change handler then looks for the current profile's group in the key file. The group isn't found, and the profile can't be restored. --- (limited to 'src/config/profiles.c') diff --git a/src/config/profiles.c b/src/config/profiles.c index 8a75401..8447ca2 100644 --- a/src/config/profiles.c +++ b/src/config/profiles.c @@ -345,6 +345,10 @@ unlink_recursive(const gchar *dir_path) gboolean mq_profiles_remove(MqProfiles *profiles, const gchar *profile) { + if (g_strcmp0(profile, profiles->current) == 0) { + return FALSE; + } + return unlink_recursive( g_build_filename(profiles->config_dir, profile, NULL)) && g_key_file_remove_group(profiles->key_file, profile, NULL); -- cgit v0.9.1