зеркало из https://github.com/mozilla/pjs.git
Bug 730013 - don't addref/release nsTransactionManager so much to prevent it to end up to the purple buffer, r=ehsan
This commit is contained in:
Родитель
3614f37f93
Коммит
d03b3983a0
|
@ -849,15 +849,11 @@ nsTextInputListener::EditAction()
|
||||||
nsCOMPtr<nsIEditor> editor;
|
nsCOMPtr<nsIEditor> editor;
|
||||||
frame->GetEditor(getter_AddRefs(editor));
|
frame->GetEditor(getter_AddRefs(editor));
|
||||||
|
|
||||||
nsCOMPtr<nsITransactionManager> manager;
|
|
||||||
editor->GetTransactionManager(getter_AddRefs(manager));
|
|
||||||
NS_ENSURE_TRUE(manager, NS_ERROR_FAILURE);
|
|
||||||
|
|
||||||
// Get the number of undo / redo items
|
// Get the number of undo / redo items
|
||||||
PRInt32 numUndoItems = 0;
|
PRInt32 numUndoItems = 0;
|
||||||
PRInt32 numRedoItems = 0;
|
PRInt32 numRedoItems = 0;
|
||||||
manager->GetNumberOfUndoItems(&numUndoItems);
|
editor->GetNumberOfUndoItems(&numUndoItems);
|
||||||
manager->GetNumberOfRedoItems(&numRedoItems);
|
editor->GetNumberOfRedoItems(&numRedoItems);
|
||||||
if ((numUndoItems && !mHadUndoItems) || (!numUndoItems && mHadUndoItems) ||
|
if ((numUndoItems && !mHadUndoItems) || (!numUndoItems && mHadUndoItems) ||
|
||||||
(numRedoItems && !mHadRedoItems) || (!numRedoItems && mHadRedoItems)) {
|
(numRedoItems && !mHadRedoItems) || (!numRedoItems && mHadRedoItems)) {
|
||||||
// Modify the menu if undo or redo items are different
|
// Modify the menu if undo or redo items are different
|
||||||
|
|
|
@ -55,7 +55,7 @@ interface nsIEditActionListener;
|
||||||
interface nsIInlineSpellChecker;
|
interface nsIInlineSpellChecker;
|
||||||
interface nsITransferable;
|
interface nsITransferable;
|
||||||
|
|
||||||
[scriptable, uuid(94479B76-7FD7-47D3-BB1E-5B77846339D2)]
|
[scriptable, uuid(656005d2-d900-4839-81bf-6274a3c38537)]
|
||||||
|
|
||||||
interface nsIEditor : nsISupports
|
interface nsIEditor : nsISupports
|
||||||
{
|
{
|
||||||
|
@ -205,6 +205,16 @@ interface nsIEditor : nsISupports
|
||||||
*/
|
*/
|
||||||
void enableUndo(in boolean enable);
|
void enableUndo(in boolean enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of items on the undo stack.
|
||||||
|
*/
|
||||||
|
readonly attribute long numberOfUndoItems;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of items on the redo stack.
|
||||||
|
*/
|
||||||
|
readonly attribute long numberOfRedoItems;
|
||||||
|
|
||||||
/** undo reverses the effects of the last Do operation,
|
/** undo reverses the effects of the last Do operation,
|
||||||
* if Undo is enabled in the editor.
|
* if Undo is enabled in the editor.
|
||||||
* It is provided here so clients need no knowledge of whether
|
* It is provided here so clients need no knowledge of whether
|
||||||
|
|
|
@ -750,6 +750,19 @@ nsEditor::EnableUndo(bool aEnable)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsEditor::GetNumberOfUndoItems(PRInt32* aNumItems)
|
||||||
|
{
|
||||||
|
*aNumItems = 0;
|
||||||
|
return mTxnMgr ? mTxnMgr->GetNumberOfUndoItems(aNumItems) : NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsEditor::GetNumberOfRedoItems(PRInt32* aNumItems)
|
||||||
|
{
|
||||||
|
*aNumItems = 0;
|
||||||
|
return mTxnMgr ? mTxnMgr->GetNumberOfRedoItems(aNumItems) : NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsEditor::GetTransactionManager(nsITransactionManager* *aTxnManager)
|
nsEditor::GetTransactionManager(nsITransactionManager* *aTxnManager)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче