mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
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:
parent
5feb5f159b
commit
ae99f8a2eb
@ -849,15 +849,11 @@ nsTextInputListener::EditAction()
|
||||
nsCOMPtr<nsIEditor> 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
|
||||
PRInt32 numUndoItems = 0;
|
||||
PRInt32 numRedoItems = 0;
|
||||
manager->GetNumberOfUndoItems(&numUndoItems);
|
||||
manager->GetNumberOfRedoItems(&numRedoItems);
|
||||
editor->GetNumberOfUndoItems(&numUndoItems);
|
||||
editor->GetNumberOfRedoItems(&numRedoItems);
|
||||
if ((numUndoItems && !mHadUndoItems) || (!numUndoItems && mHadUndoItems) ||
|
||||
(numRedoItems && !mHadRedoItems) || (!numRedoItems && mHadRedoItems)) {
|
||||
// Modify the menu if undo or redo items are different
|
||||
|
@ -55,7 +55,7 @@ interface nsIEditActionListener;
|
||||
interface nsIInlineSpellChecker;
|
||||
interface nsITransferable;
|
||||
|
||||
[scriptable, uuid(94479B76-7FD7-47D3-BB1E-5B77846339D2)]
|
||||
[scriptable, uuid(656005d2-d900-4839-81bf-6274a3c38537)]
|
||||
|
||||
interface nsIEditor : nsISupports
|
||||
{
|
||||
@ -205,6 +205,16 @@ interface nsIEditor : nsISupports
|
||||
*/
|
||||
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,
|
||||
* if Undo is enabled in the editor.
|
||||
* It is provided here so clients need no knowledge of whether
|
||||
|
@ -750,6 +750,19 @@ nsEditor::EnableUndo(bool aEnable)
|
||||
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
|
||||
nsEditor::GetTransactionManager(nsITransactionManager* *aTxnManager)
|
||||
|
Loading…
Reference in New Issue
Block a user