Fixed double addref in EnableUndo() that was causing us to leak the transaction manager on destruction of the editor.

git-svn-id: svn://10.0.0.236/trunk@33158 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
kin%netscape.com
1999-05-28 21:49:24 +00:00
parent c591be3574
commit ffa546bdb8
2 changed files with 4 additions and 8 deletions

View File

@@ -472,7 +472,6 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell)
NS_IMETHODIMP
nsEditor::EnableUndo(PRBool aEnable)
{
nsITransactionManager *txnMgr = 0;
nsresult result=NS_OK;
if (PR_TRUE==aEnable)
@@ -481,12 +480,11 @@ nsEditor::EnableUndo(PRBool aEnable)
{
result = gCompMgr->CreateInstance(kCTransactionManagerCID,
nsnull,
nsITransactionManager::GetIID(), (void **)&txnMgr);
if (NS_FAILED(result) || !txnMgr) {
nsITransactionManager::GetIID(), getter_AddRefs(mTxnMgr));
if (NS_FAILED(result) || !mTxnMgr) {
printf("ERROR: Failed to get TransactionManager instance.\n");
return NS_ERROR_NOT_AVAILABLE;
}
mTxnMgr = do_QueryInterface(txnMgr); // CreateInstance refCounted the instance for us, remember it in an nsCOMPtr
#ifdef DEBUG_WITH_JS_EDITOR_LOG
nsJSEditorLog *log = new nsJSEditorLog();