diff options
| author | Brian Munro <brian.alexander.munro@gmail.com> | 2017-12-27 10:40:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-27 10:40:59 +0200 |
| commit | 91bd9b1eb6badea4558ba1c4ad0bac9549c5b314 (patch) | |
| tree | e236e2c472188d834bcf9215ed19527332e31e27 /src/modlist.cpp | |
| parent | 35e0bc22856c8f29e3c29ec27bd7c3c5a882197f (diff) | |
| parent | 548744d746223f0f96b33587ca41d2ed6a314f33 (diff) | |
Merge pull request #168 from erasmux/dev
Various fixes
Diffstat (limited to 'src/modlist.cpp')
| -rw-r--r-- | src/modlist.cpp | 15 |
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
|
