Bug 769894 - Part 1: Create PromptService's AlertDialog on the UI thread. r=mfinkle

This commit is contained in:
Chris Peterson 2012-09-04 12:33:07 -07:00
parent 111e917ff3
commit 9015e11bc7

View File

@ -190,7 +190,7 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
}
});
AlertDialog.Builder builder = new AlertDialog.Builder(GeckoApp.mAppContext);
final AlertDialog.Builder builder = new AlertDialog.Builder(GeckoApp.mAppContext);
if (!aTitle.equals("")) {
builder.setTitle(aTitle);
}
@ -256,9 +256,14 @@ public class PromptService implements OnClickListener, OnCancelListener, OnItemC
builder.setNegativeButton(aButtons[2].label, this);
}
mDialog = builder.create();
mDialog.setOnCancelListener(this);
mDialog.show();
// The AlertDialog must be created on the UI thread, not the GeckoBackgroundThread.
GeckoAppShell.getMainHandler().post(new Runnable() {
public void run() {
mDialog = builder.create();
mDialog.setOnCancelListener(PromptService.this);
mDialog.show();
}
});
}
public void onClick(DialogInterface aDialog, int aWhich) {