ChangeScreen: Avoid race condition for revision changes
loadConfigInfo called renderChangeInfo which called renderRevisionInfo with an empty argument list to initialise the the revision action buttons. The call to renderChangeInfo however was done via a callback, such that we are not sure how long it takes until renderChangeInfo is called. By moving loadRevisionInfo which load the actual revision action info into that callback we can be sure to not have a race of the callback for the callchain as described above and the callback in loadRevisionInfo to render the correct revision info. This will add one round trip time, however it actually fixes a bug. Bug: issue 3192 Change-Id: I186ca5306a29e785981c809c92d51f7a0fb3e71a
This commit is contained in:
@@ -240,10 +240,7 @@ public class ChangeScreen extends Screen {
|
||||
@Override
|
||||
public void onSuccess(ChangeInfo info) {
|
||||
info.init();
|
||||
// Revision loading may be slower than the rest, so do it
|
||||
// asynchronous to have the rest fast.
|
||||
loadConfigInfo(info, base);
|
||||
loadRevisionInfo();
|
||||
}
|
||||
}));
|
||||
}
|
||||
@@ -817,6 +814,7 @@ public class ChangeScreen extends Screen {
|
||||
commentLinkProcessor = result.getCommentLinkProcessor();
|
||||
setTheme(result.getTheme());
|
||||
renderChangeInfo(info);
|
||||
loadRevisionInfo();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user