[desktop] Fix double profile deletion (#3422)

Classic case of double-emission of signals. Epic

Also fixed a bug that caused profile manager to not immediately update when a profile was deleted from Qlaunch.

Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3422
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
This commit is contained in:
crueter 2026-01-30 14:35:05 +01:00
parent a692986bd7
commit 8b55a15808
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6
4 changed files with 32 additions and 25 deletions

View file

@ -88,11 +88,14 @@ bool ProfileManager::RemoveProfileAtIndex(std::size_t index) {
if (index >= MAX_USERS || index >= user_count) {
return false;
}
if (index < user_count - 1) {
std::rotate(profiles.begin() + index, profiles.begin() + index + 1, profiles.end());
}
profiles.back() = {};
user_count--;
profiles[index] = ProfileInfo{};
std::stable_partition(profiles.begin(), profiles.end(),
[](const ProfileInfo& profile) { return profile.user_uuid.IsValid(); });
is_save_needed = true;
WriteUserSaveFile();
return true;
}
@ -355,14 +358,7 @@ bool ProfileManager::RemoveUser(UUID uuid) {
return false;
}
profiles[*index] = ProfileInfo{};
std::stable_partition(profiles.begin(), profiles.end(),
[](const ProfileInfo& profile) { return profile.user_uuid.IsValid(); });
is_save_needed = true;
WriteUserSaveFile();
return true;
return RemoveProfileAtIndex(*index);
}
bool ProfileManager::SetProfileBase(UUID uuid, const ProfileBase& profile_new) {

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
@ -97,6 +97,8 @@ public:
bool CanSystemRegisterUser() const;
bool RemoveUser(Common::UUID uuid);
bool RemoveProfileAtIndex(std::size_t index);
bool SetProfileBase(Common::UUID uuid, const ProfileBase& profile_new);
bool SetProfileBaseAndData(Common::UUID uuid, const ProfileBase& profile_new,
const UserData& data_new);
@ -113,7 +115,6 @@ public:
private:
void ParseUserSaveFile();
std::optional<std::size_t> AddToProfiles(const ProfileInfo& profile);
bool RemoveProfileAtIndex(std::size_t index);
void RemoveAllProfiles();
bool is_save_needed{};