mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 02:31:59 +00:00
IMplement factory in this class; AddRef during QueryInterface like it should; init refcnt in ctor
This commit is contained in:
parent
ddc78890a7
commit
1493956e90
@ -18,6 +18,14 @@
|
||||
#include "nsSelection.h"
|
||||
#include "nsISelection.h"
|
||||
|
||||
NS_LAYOUT nsresult
|
||||
NS_NewSelection(nsISelection** aInstancePtrResult)
|
||||
{
|
||||
static NS_DEFINE_IID(kISelectionIID, NS_ISELECTION_IID);
|
||||
nsSelection * sel = new nsSelection();
|
||||
return sel->QueryInterface(kISelectionIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsresult nsSelection::QueryInterface(const nsIID& aIID,
|
||||
void** aInstancePtrResult)
|
||||
{
|
||||
@ -28,13 +36,14 @@ nsresult nsSelection::QueryInterface(const nsIID& aIID,
|
||||
}
|
||||
if (aIID.Equals(kISelectionIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsISelection*)this);
|
||||
//AddRef();
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return !NS_OK;
|
||||
}
|
||||
|
||||
nsSelection::nsSelection() {
|
||||
NS_INIT_REFCNT();
|
||||
mRange = new nsSelectionRange();
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,14 @@
|
||||
#include "nsSelection.h"
|
||||
#include "nsISelection.h"
|
||||
|
||||
NS_LAYOUT nsresult
|
||||
NS_NewSelection(nsISelection** aInstancePtrResult)
|
||||
{
|
||||
static NS_DEFINE_IID(kISelectionIID, NS_ISELECTION_IID);
|
||||
nsSelection * sel = new nsSelection();
|
||||
return sel->QueryInterface(kISelectionIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsresult nsSelection::QueryInterface(const nsIID& aIID,
|
||||
void** aInstancePtrResult)
|
||||
{
|
||||
@ -28,13 +36,14 @@ nsresult nsSelection::QueryInterface(const nsIID& aIID,
|
||||
}
|
||||
if (aIID.Equals(kISelectionIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsISelection*)this);
|
||||
//AddRef();
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return !NS_OK;
|
||||
}
|
||||
|
||||
nsSelection::nsSelection() {
|
||||
NS_INIT_REFCNT();
|
||||
mRange = new nsSelectionRange();
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,14 @@
|
||||
#include "nsSelection.h"
|
||||
#include "nsISelection.h"
|
||||
|
||||
NS_LAYOUT nsresult
|
||||
NS_NewSelection(nsISelection** aInstancePtrResult)
|
||||
{
|
||||
static NS_DEFINE_IID(kISelectionIID, NS_ISELECTION_IID);
|
||||
nsSelection * sel = new nsSelection();
|
||||
return sel->QueryInterface(kISelectionIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsresult nsSelection::QueryInterface(const nsIID& aIID,
|
||||
void** aInstancePtrResult)
|
||||
{
|
||||
@ -28,13 +36,14 @@ nsresult nsSelection::QueryInterface(const nsIID& aIID,
|
||||
}
|
||||
if (aIID.Equals(kISelectionIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsISelection*)this);
|
||||
//AddRef();
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return !NS_OK;
|
||||
}
|
||||
|
||||
nsSelection::nsSelection() {
|
||||
NS_INIT_REFCNT();
|
||||
mRange = new nsSelectionRange();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user