mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 02:39:05 +01:00
Make field that's used on background thread volatile.
This commit is contained in:
@@ -26,7 +26,7 @@ public class SetupControllerImpl extends PasswordControllerImpl
|
||||
Logger.getLogger(SetupControllerImpl.class.getName());
|
||||
|
||||
@Nullable
|
||||
private SetupActivity setupActivity; // TODO: Should be volatile
|
||||
private volatile SetupActivity setupActivity;
|
||||
|
||||
@Inject
|
||||
SetupControllerImpl(SharedPreferences briarPrefs,
|
||||
@@ -44,6 +44,7 @@ public class SetupControllerImpl extends PasswordControllerImpl
|
||||
|
||||
@Override
|
||||
public boolean needToShowDozeFragment() {
|
||||
SetupActivity setupActivity = this.setupActivity;
|
||||
if (setupActivity == null) throw new IllegalStateException();
|
||||
return DozeView.needsToBeShown(setupActivity) ||
|
||||
HuaweiView.needsToBeShown(setupActivity);
|
||||
@@ -51,31 +52,35 @@ public class SetupControllerImpl extends PasswordControllerImpl
|
||||
|
||||
@Override
|
||||
public void setAuthorName(String authorName) {
|
||||
SetupActivity setupActivity = this.setupActivity;
|
||||
if (setupActivity == null) throw new IllegalStateException();
|
||||
setupActivity.setAuthorName(authorName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPassword(String password) {
|
||||
SetupActivity setupActivity = this.setupActivity;
|
||||
if (setupActivity == null) throw new IllegalStateException();
|
||||
setupActivity.setPassword(password);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showPasswordFragment() {
|
||||
SetupActivity setupActivity = this.setupActivity;
|
||||
if (setupActivity == null) throw new IllegalStateException();
|
||||
setupActivity.showPasswordFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showDozeFragment() {
|
||||
SetupActivity setupActivity = this.setupActivity;
|
||||
if (setupActivity == null) throw new IllegalStateException();
|
||||
setupActivity.showDozeFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createAccount() {
|
||||
if (setupActivity == null) throw new IllegalStateException();
|
||||
SetupActivity setupActivity = this.setupActivity;
|
||||
UiResultHandler<Void> resultHandler =
|
||||
new UiResultHandler<Void>(setupActivity) {
|
||||
@Override
|
||||
@@ -90,6 +95,7 @@ public class SetupControllerImpl extends PasswordControllerImpl
|
||||
|
||||
// Package access for testing
|
||||
void createAccount(ResultHandler<Void> resultHandler) {
|
||||
SetupActivity setupActivity = this.setupActivity;
|
||||
if (setupActivity == null) throw new IllegalStateException();
|
||||
String authorName = setupActivity.getAuthorName();
|
||||
if (authorName == null) throw new IllegalStateException();
|
||||
|
||||
Reference in New Issue
Block a user