Bug 788216 - Create the SetupScreen on the main UI thread instead of the GeckoBackgroundThread. r=gcp a=lsblakk

This commit is contained in:
Kartikaya Gupta 2012-10-23 10:55:16 -04:00
Родитель efcb586af6
Коммит 285408138e
1 изменённых файлов: 15 добавлений и 3 удалений

Просмотреть файл

@ -2300,13 +2300,20 @@ abstract public class GeckoApp
!profileMigrator.hasMigrationRun()) {
// Show the "Setting up Fennec" screen if this takes
// a while.
final SetupScreen setupScreen = new SetupScreen(app);
// Create a "final" holder for the setup screen so that we can
// create it in startCallback and still find a reference to it
// in stopCallback. (We must create it on the UI thread to fix
// bug 788216). Note that synchronization is not a problem here
// since it is only ever touched on the UI thread.
final SetupScreen[] setupScreenHolder = new SetupScreen[1];
final Runnable startCallback = new Runnable() {
public void run() {
GeckoApp.mAppContext.runOnUiThread(new Runnable() {
public void run() {
setupScreen.show();
setupScreenHolder[0] = new SetupScreen(app);
setupScreenHolder[0].show();
}
});
}
@ -2316,7 +2323,12 @@ abstract public class GeckoApp
public void run() {
GeckoApp.mAppContext.runOnUiThread(new Runnable() {
public void run() {
setupScreen.dismiss();
SetupScreen screen = setupScreenHolder[0];
// screen will never be null if this code runs, but
// stranger things have happened...
if (screen != null) {
screen.dismiss();
}
}
});
}