Fixed: Thread safe access to RsControlModule member variables

This commit is contained in:
Konrad 2017-04-13 13:40:30 +02:00
parent dcc8c6e4c3
commit 144d57047c

View File

@ -136,7 +136,11 @@ void RsControlModule::run()
bool login_ok = false; bool login_ok = false;
while(!login_ok) while(!login_ok)
{ {
mPassword = ""; {
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
mPassword = "";
}
// skip account selection if autologin is available // skip account selection if autologin is available
if(initResult != RS_INIT_HAVE_ACCOUNT) if(initResult != RS_INIT_HAVE_ACCOUNT)
setRunState(WAITING_ACCOUNT_SELECT); setRunState(WAITING_ACCOUNT_SELECT);
@ -188,11 +192,17 @@ void RsControlModule::run()
break; break;
} }
mLoadPeerId.clear(); {
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
mLoadPeerId.clear();
}
} }
mFixedPassword = mPassword; {
mPassword = ""; RsStackMutex stack(mDataMtx); // ********** LOCKED **********
mFixedPassword = mPassword;
mPassword = "";
}
setRunState(WAITING_STARTUP); setRunState(WAITING_STARTUP);