Bug 580151 - Part 2: Make sure that we decrement the counter even if creating a selection state or saving it fails; r=roc

--HG--
extra : rebase_source : 1e3d9fe47c083b8614b8a4c2937578bb1bcbfcfb
This commit is contained in:
Ehsan Akhgari 2010-07-20 09:18:54 -04:00
Родитель d030becab3
Коммит 1f46e678f4
1 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

@ -861,11 +861,12 @@ nsEditor::BeginPlaceHolderTransaction(nsIAtom *aName)
mPlaceHolderName = aName;
nsCOMPtr<nsISelection> selection;
nsresult res = GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(res, res);
mSelState = new nsSelectionState();
NS_ENSURE_TRUE(mSelState, NS_ERROR_OUT_OF_MEMORY);
mSelState->SaveSelection(selection);
if (NS_SUCCEEDED(res)) {
mSelState = new nsSelectionState();
if (mSelState) {
mSelState->SaveSelection(selection);
}
}
}
mPlaceHolderBatch++;