mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
fixed illegal use of nsCOMPtr
This commit is contained in:
parent
c48a20536f
commit
ab2b06f0c5
@ -221,7 +221,7 @@ NS_IMETHODIMP EditAggregateTxn::QueryInterface(REFNSIID aIID, void** aInstancePt
|
||||
{
|
||||
if (!aInstancePtr) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aIID.Equals(EditAggregateTxn::GetIID())) {
|
||||
if (aIID.Equals(EditAggregateTxn::GetCID())) {
|
||||
*aInstancePtr = (nsISupports*)(EditAggregateTxn*)(this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
@ -40,6 +40,8 @@ public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
static const nsIID& GetCID() { static nsIID cid = EDIT_AGGREGATE_TXN_IID; return cid; }
|
||||
|
||||
EditAggregateTxn();
|
||||
|
||||
virtual ~EditAggregateTxn();
|
||||
|
@ -107,7 +107,8 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti
|
||||
{
|
||||
// if aTransaction isa InsertTextTxn, and if the selection hasn't changed,
|
||||
// then absorb it
|
||||
nsCOMPtr<InsertTextTxn> otherTxn( do_QueryInterface(aTransaction) );
|
||||
InsertTextTxn *otherTxn = nsnull;
|
||||
aTransaction->QueryInterface(kInsertTextTxnIID, (void **)&otherTxn);
|
||||
if (otherTxn)
|
||||
{
|
||||
if (PR_TRUE==IsSequentialInsert(otherTxn))
|
||||
@ -118,10 +119,12 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti
|
||||
*aDidMerge = PR_TRUE;
|
||||
if (gNoisy) { printf("InsertTextTxn assimilated %p\n", aTransaction); }
|
||||
}
|
||||
NS_RELEASE(otherTxn);
|
||||
}
|
||||
else
|
||||
{ // the next InsertTextTxn might be inside an aggregate that we have special knowledge of
|
||||
nsCOMPtr<EditAggregateTxn> otherTxn( do_QueryInterface(aTransaction) );
|
||||
EditAggregateTxn *otherTxn = nsnull;
|
||||
aTransaction->QueryInterface(EditAggregateTxn::GetCID(), (void **)&otherTxn);
|
||||
if (otherTxn)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> txnName;
|
||||
@ -149,6 +152,7 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_RELEASE(otherTxn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ NS_IMETHODIMP EditAggregateTxn::QueryInterface(REFNSIID aIID, void** aInstancePt
|
||||
{
|
||||
if (!aInstancePtr) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aIID.Equals(EditAggregateTxn::GetIID())) {
|
||||
if (aIID.Equals(EditAggregateTxn::GetCID())) {
|
||||
*aInstancePtr = (nsISupports*)(EditAggregateTxn*)(this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
@ -40,6 +40,8 @@ public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
static const nsIID& GetCID() { static nsIID cid = EDIT_AGGREGATE_TXN_IID; return cid; }
|
||||
|
||||
EditAggregateTxn();
|
||||
|
||||
virtual ~EditAggregateTxn();
|
||||
|
@ -107,7 +107,8 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti
|
||||
{
|
||||
// if aTransaction isa InsertTextTxn, and if the selection hasn't changed,
|
||||
// then absorb it
|
||||
nsCOMPtr<InsertTextTxn> otherTxn( do_QueryInterface(aTransaction) );
|
||||
InsertTextTxn *otherTxn = nsnull;
|
||||
aTransaction->QueryInterface(kInsertTextTxnIID, (void **)&otherTxn);
|
||||
if (otherTxn)
|
||||
{
|
||||
if (PR_TRUE==IsSequentialInsert(otherTxn))
|
||||
@ -118,10 +119,12 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti
|
||||
*aDidMerge = PR_TRUE;
|
||||
if (gNoisy) { printf("InsertTextTxn assimilated %p\n", aTransaction); }
|
||||
}
|
||||
NS_RELEASE(otherTxn);
|
||||
}
|
||||
else
|
||||
{ // the next InsertTextTxn might be inside an aggregate that we have special knowledge of
|
||||
nsCOMPtr<EditAggregateTxn> otherTxn( do_QueryInterface(aTransaction) );
|
||||
EditAggregateTxn *otherTxn = nsnull;
|
||||
aTransaction->QueryInterface(EditAggregateTxn::GetCID(), (void **)&otherTxn);
|
||||
if (otherTxn)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> txnName;
|
||||
@ -149,6 +152,7 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_RELEASE(otherTxn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user