mPresShell = nsnull;
DocumentViewerImpl::Destroy(){  // All callers are supposed to call destroy to break circular  // references.  If we do this stuff in the destructor, the  // destructor might never be called (especially if we're being  // used from JS.  // Avoid leaking the old viewer.  if (mPreviousViewer) {    mPreviousViewer->Destroy();    mPreviousViewer = nsnull;  }  if (mDeviceContext)    mDeviceContext->FlushFontCache();  if (mPresShell) {    // Break circular reference (or something)    mPresShell->EndObservingDocument();    nsCOMPtr<nsISelection> selection;    nsresult rv = GetDocumentSelection(getter_AddRefs(selection));    nsCOMPtr<nsISelectionPrivate> selPrivate(do_QueryInterface(selection));    if (NS_SUCCEEDED(rv) && selPrivate && mSelectionListener)       selPrivate->RemoveSelectionListener(mSelectionListener);    mPresShell = nsnull;  }    return NS_OK;}