nsresult rv = m_virtualFolder->GetDBFolderInfoAndDB(getter_AddRefs(dbFolderInfo), getter_AddRefs(virtDatabase));
rv = m_virtualFolder->GetDBFolderInfoAndDB(getter_AddRefs(dbFolderInfo), getter_AddRefs(virtDatabase));
NS_IMETHODIMP VirtualFolderChangeListener::OnHdrDeleted(nsIMsgDBHdr *aHdrDeleted, nsMsgKey aParentKey, PRInt32 aFlags, nsIDBChangeListener *aInstigator){  nsCOMPtr <nsIMsgDatabase> msgDB;  nsresult rv = m_folderWatching->GetMsgDatabase(nsnull, getter_AddRefs(msgDB));  NS_ENSURE_SUCCESS(rv, rv);  PRBool match = PR_FALSE;  rv = m_searchSession->MatchHdr(aHdrDeleted, msgDB, &match);  if (match)  {    nsCOMPtr <nsIMsgDatabase> virtDatabase;    nsCOMPtr <nsIDBFolderInfo> dbFolderInfo;    nsresult rv = m_virtualFolder->GetDBFolderInfoAndDB(getter_AddRefs(dbFolderInfo), getter_AddRefs(virtDatabase));    PRBool msgHdrIsRead;    aHdrDeleted->GetIsRead(&msgHdrIsRead);    if (!msgHdrIsRead)      dbFolderInfo->ChangeNumUnreadMessages(-1);    dbFolderInfo->ChangeNumMessages(-1);    PRUint32 hdrFlags;    aHdrDeleted->GetFlags(&hdrFlags);    if (hdrFlags & MSG_FLAG_NEW)    {      PRInt32 numNewMessages;      m_virtualFolder->GetNumNewMessages(PR_FALSE, &numNewMessages);      m_virtualFolder->SetNumNewMessages(numNewMessages - 1);      if (numNewMessages == 1)        m_virtualFolder->SetHasNewMessages(PR_FALSE);    }    m_virtualFolder->UpdateSummaryTotals(PR_TRUE); // force update from db.    virtDatabase->Commit(nsMsgDBCommitType::kLargeCommit);  }  return rv;}