Crash in print spooler when back pressed before content update complted.

We are updating the printed content asynchronously. If the user cancels
printing before the first update is complete the spooler components are
in a destroyed state but we attempt to handle the completed update resulting
in a crash. Now if printing is cancelled we ignore the update result.

bug:18525491

Change-Id: I1ef47a17de19896cba2c7a1dd2bfc205065e0a5a
This commit is contained in:
Svet Ganov
2014-11-26 04:09:27 -08:00
committed by Svetoslav Ganov
parent 5aeed158df
commit eaaf0512fc
2 changed files with 7 additions and 1 deletions

View File

@@ -486,7 +486,9 @@ public final class PageContentRepository {
protected Void doInBackground(Void... params) { protected Void doInBackground(Void... params) {
synchronized (mLock) { synchronized (mLock) {
try { try {
mRenderer.closeDocument(); if (mRenderer != null) {
mRenderer.closeDocument();
}
} catch (RemoteException re) { } catch (RemoteException re) {
/* ignore */ /* ignore */
} }

View File

@@ -487,6 +487,10 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
requestCreatePdfFileOrFinish(); requestCreatePdfFileOrFinish();
} break; } break;
case STATE_PRINT_CANCELED: {
updateOptionsUi();
} break;
default: { default: {
updatePrintPreviewController(document.changed); updatePrintPreviewController(document.changed);