Fix possible crash in usernames order saving.

This commit is contained in:
John Preston
2025-11-24 14:47:14 +04:00
parent 1ae5495b91
commit b02ce599e6
@@ -2294,6 +2294,9 @@ void Controller::saveUsernamesOrder() {
continueSave();
}).send();
} else {
const auto weakContinue = crl::guard(this, [=] {
continueSave();
});
const auto lifetime = std::make_shared<rpl::lifetime>();
const auto newUsernames = (*_savingData.usernamesOrder);
_peer->session().api().usernames().reorder(
@@ -2311,7 +2314,7 @@ void Controller::saveUsernamesOrder() {
.editable = editable,
};
}) | ranges::to_vector);
continueSave();
weakContinue();
lifetime->destroy();
}, *lifetime);
}