IMplement factory in this class; AddRef during QueryInterface like it should; init refcnt in ctor

This commit is contained in:
kipp 1998-06-03 15:47:22 +00:00
Родитель ddc78890a7
Коммит 1493956e90
3 изменённых файлов: 30 добавлений и 3 удалений

Просмотреть файл

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