forked from mirrors/gecko-dev
IMplement factory in this class; AddRef during QueryInterface like it should; init refcnt in ctor
This commit is contained in:
parent
ddc78890a7
commit
1493956e90
3 changed files with 30 additions and 3 deletions
|
|
@ -18,6 +18,14 @@
|
||||||
#include "nsSelection.h"
|
#include "nsSelection.h"
|
||||||
#include "nsISelection.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,
|
nsresult nsSelection::QueryInterface(const nsIID& aIID,
|
||||||
void** aInstancePtrResult)
|
void** aInstancePtrResult)
|
||||||
{
|
{
|
||||||
|
|
@ -28,13 +36,14 @@ nsresult nsSelection::QueryInterface(const nsIID& aIID,
|
||||||
}
|
}
|
||||||
if (aIID.Equals(kISelectionIID)) {
|
if (aIID.Equals(kISelectionIID)) {
|
||||||
*aInstancePtrResult = (void*) ((nsISelection*)this);
|
*aInstancePtrResult = (void*) ((nsISelection*)this);
|
||||||
//AddRef();
|
AddRef();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
return !NS_OK;
|
return !NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSelection::nsSelection() {
|
nsSelection::nsSelection() {
|
||||||
|
NS_INIT_REFCNT();
|
||||||
mRange = new nsSelectionRange();
|
mRange = new nsSelectionRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,14 @@
|
||||||
#include "nsSelection.h"
|
#include "nsSelection.h"
|
||||||
#include "nsISelection.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,
|
nsresult nsSelection::QueryInterface(const nsIID& aIID,
|
||||||
void** aInstancePtrResult)
|
void** aInstancePtrResult)
|
||||||
{
|
{
|
||||||
|
|
@ -28,13 +36,14 @@ nsresult nsSelection::QueryInterface(const nsIID& aIID,
|
||||||
}
|
}
|
||||||
if (aIID.Equals(kISelectionIID)) {
|
if (aIID.Equals(kISelectionIID)) {
|
||||||
*aInstancePtrResult = (void*) ((nsISelection*)this);
|
*aInstancePtrResult = (void*) ((nsISelection*)this);
|
||||||
//AddRef();
|
AddRef();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
return !NS_OK;
|
return !NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSelection::nsSelection() {
|
nsSelection::nsSelection() {
|
||||||
|
NS_INIT_REFCNT();
|
||||||
mRange = new nsSelectionRange();
|
mRange = new nsSelectionRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,14 @@
|
||||||
#include "nsSelection.h"
|
#include "nsSelection.h"
|
||||||
#include "nsISelection.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,
|
nsresult nsSelection::QueryInterface(const nsIID& aIID,
|
||||||
void** aInstancePtrResult)
|
void** aInstancePtrResult)
|
||||||
{
|
{
|
||||||
|
|
@ -28,13 +36,14 @@ nsresult nsSelection::QueryInterface(const nsIID& aIID,
|
||||||
}
|
}
|
||||||
if (aIID.Equals(kISelectionIID)) {
|
if (aIID.Equals(kISelectionIID)) {
|
||||||
*aInstancePtrResult = (void*) ((nsISelection*)this);
|
*aInstancePtrResult = (void*) ((nsISelection*)this);
|
||||||
//AddRef();
|
AddRef();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
return !NS_OK;
|
return !NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSelection::nsSelection() {
|
nsSelection::nsSelection() {
|
||||||
|
NS_INIT_REFCNT();
|
||||||
mRange = new nsSelectionRange();
|
mRange = new nsSelectionRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue