diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-11-11 10:39:45 (EST) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-11-11 10:39:45 (EST) |
commit | 823fab41a48e38cd74c5bd317d8087dc7b283a43 (patch) | |
tree | a7f226a747672db4f92a44835323bb4aed3e0293 /src | |
parent | be8d2a019686850916f9a624522f69e91c891fc9 (diff) | |
download | marquee-823fab41a48e38cd74c5bd317d8087dc7b283a43.zip marquee-823fab41a48e38cd74c5bd317d8087dc7b283a43.tar.gz marquee-823fab41a48e38cd74c5bd317d8087dc7b283a43.tar.bz2 |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/config/profiles.c | 4 |
1 files changed, 4 insertions, 0 deletions
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); |