fixed illegal use of nsCOMPtr

This commit is contained in:
buster%netscape.com 1999-06-24 23:33:18 +00:00
parent c48a20536f
commit ab2b06f0c5
6 changed files with 18 additions and 6 deletions

View File

@ -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;

View File

@ -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();

View File

@ -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);
}
}
}

View File

@ -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;

View File

@ -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();

View File

@ -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);
}
}
}