summaryrefslogtreecommitdiff
path: root/src/modlist.cpp
diff options
context:
space:
mode:
authorEran Mizrahi <erasmux@gmail.com>2017-12-26 19:07:55 +0200
committerEran Mizrahi <erasmux@gmail.com>2017-12-26 19:07:55 +0200
commitfed4ea257ab7ae7c154c4c4e3ac6ec8fd4093f59 (patch)
treef14fecc7d8034d9debdd9a383f95217e2dd3e99b /src/modlist.cpp
parent35e0bc22856c8f29e3c29ec27bd7c3c5a882197f (diff)
Fix mods priorities getting messed up when renaming a mod
Diffstat (limited to 'src/modlist.cpp')
-rw-r--r--src/modlist.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp
index 046e2280..4002a424 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -426,13 +426,16 @@ bool ModList::renameMod(int index, const QString &newName)
ModInfo::Ptr modInfo = ModInfo::getByIndex(index);
QString oldName = modInfo->name();
- if (newName != oldName && modInfo->setName(nameFixed)) {
- // before we rename, write back the current profile so we don't lose changes and to ensure
- // there is no scheduled asynchronous rewrite anytime soon
- m_Profile->writeModlistNow();
+ if (newName != oldName) {
+ // before we rename, ensure there is no scheduled asynchronous to rewrite
+ m_Profile->cancelModlistWrite();
- // this just disabled the mod in all profiles. The recipient of modRenamed must fix that
- emit modRenamed(oldName, nameFixed);
+
+ if (modInfo->setName(nameFixed))
+ // Notice there is a good chance that setName() updated the modinfo indexes
+ // the modRenamed() call will refresh the indexes in the current profile
+ // and update the modlists in all profiles
+ emit modRenamed(oldName, nameFixed);
}
// invalidate the currently displayed state of this list