Fixes a bug where the wrong account could be marked as "in use" when the game is launched if there are multiple accounts that share the same profile ID. This can lead to the launcher trying to refresh an account that's currently in use by the game, leading to "Invalid session" errors in-game. Signed-off-by: Evan Goode <mail@evangoo.de>
27 lines
621 B
C++
27 lines
621 B
C++
#include "ClaimAccount.h"
|
|
#include <launch/LaunchTask.h>
|
|
|
|
#include "Application.h"
|
|
#include "minecraft/auth/AccountList.h"
|
|
|
|
ClaimAccount::ClaimAccount(LaunchTask* parent, AuthSessionPtr session) : LaunchStep(parent)
|
|
{
|
|
if (session->status == AuthSession::Status::PlayableOnline && !session->demo) {
|
|
auto accounts = APPLICATION->accounts();
|
|
m_account = accounts->getAccountByInternalId(session->account_id);
|
|
}
|
|
}
|
|
|
|
void ClaimAccount::executeTask()
|
|
{
|
|
if (m_account) {
|
|
lock.reset(new UseLock(m_account));
|
|
emitSucceeded();
|
|
}
|
|
}
|
|
|
|
void ClaimAccount::finalize()
|
|
{
|
|
lock.reset();
|
|
}
|