зеркало из https://github.com/mozilla/gecko-dev.git
Changed some AddRef/Release calls overto use XP-COM macros
This commit is contained in:
Родитель
1e85684495
Коммит
fda3dbd970
|
@ -431,44 +431,44 @@ nsWebShell::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
}
|
||||
if (aIID.Equals(kIWebShellIID)) {
|
||||
*aInstancePtr = (void*)(nsIWebShell*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIContentViewerContainerIID)) {
|
||||
*aInstancePtr = (void*)(nsIContentViewerContainer*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIScriptContextOwnerIID)) {
|
||||
*aInstancePtr = (void*)(nsIScriptContextOwner*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDocumentLoaderObserverIID)) {
|
||||
*aInstancePtr = (void*)(nsIDocumentLoaderObserver*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIWebShellContainerIID)) {
|
||||
*aInstancePtr = (void*)(nsIWebShellContainer*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kILinkHandlerIID)) {
|
||||
//I added this for plugin support of jumping
|
||||
//through links. maybe there is a better way... MMP
|
||||
*aInstancePtr = (void*)(nsILinkHandler*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kRefreshURLIID)) {
|
||||
*aInstancePtr = (void*)(nsIRefreshUrl*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)(nsIWebShell*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (nsnull != mInnerWindow) {
|
||||
|
@ -486,12 +486,12 @@ nsWebShell::QueryCapability(const nsIID &aIID, void** aInstancePtr)
|
|||
|
||||
if (aIID.Equals(kILinkHandlerIID)) {
|
||||
*aInstancePtr = (void*) ((nsILinkHandler*)this);
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIScriptContextOwnerIID)) {
|
||||
*aInstancePtr = (void*) ((nsIScriptContextOwner*)this);
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -620,6 +620,7 @@ nsWebShell::Init(nsNativeWidget aNativeParent,
|
|||
mWindow->Create(aNativeParent, aBounds, nsWebShell::HandleEvent,
|
||||
mDeviceContext, nsnull, nsnull, &widgetInit);
|
||||
// Get rid of extra reference count
|
||||
// XXX FIX ME...
|
||||
mWindow->Release();
|
||||
}
|
||||
|
||||
|
@ -1696,7 +1697,7 @@ nsWebShell::CancelRefreshURLTimers(void) {
|
|||
mRefreshments.RemoveElementAt(tmp);
|
||||
if (timer) {
|
||||
timer->Cancel();
|
||||
timer->Release();
|
||||
NS_RELEASE(timer);
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
|
@ -1847,7 +1848,7 @@ nsWebShellFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
AddRef(); // Increase reference count for caller
|
||||
NS_ADDREF_THIS(); // Increase reference count for caller
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1884,7 +1885,7 @@ nsWebShellFactory::CreateInstance(nsISupports *aOuter,
|
|||
goto done;
|
||||
}
|
||||
|
||||
inst = new nsWebShell();
|
||||
NS_NEWXPCOM(inst, nsWebShell);
|
||||
if (inst == NULL) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
goto done;
|
||||
|
|
|
@ -150,17 +150,17 @@ nsresult DocumentViewerImpl::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
|
||||
if (aIID.Equals(kIContentViewerIID)) {
|
||||
*aInstancePtr = (void*)(nsIContentViewer*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDocumentViewerIID)) {
|
||||
*aInstancePtr = (void*)(nsIDocumentViewer*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)(nsIContentViewer*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
|
@ -278,6 +278,7 @@ DocumentViewerImpl::Init(nsNativeWidget aNativeParent,
|
|||
|
||||
// Init(...) will addref the Presentation Context...
|
||||
if (NS_OK == rv) {
|
||||
// XXX FIX ME...
|
||||
mPresContext->Release();
|
||||
}
|
||||
return rv;
|
||||
|
|
|
@ -193,13 +193,13 @@ PluginViewerImpl::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (aIID.Equals(kIContentViewerIID)) {
|
||||
nsIContentViewer* tmp = this;
|
||||
*aInstancePtr = (void*)tmp;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
nsISupports* tmp = this;
|
||||
*aInstancePtr = (void*)tmp;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
|
|
|
@ -111,7 +111,7 @@ public:
|
|||
nsrefcnt ReleaseObject() {
|
||||
NS_PRECONDITION(0 != mRefCnt, "dup release");
|
||||
if (--mRefCnt == 0) {
|
||||
delete this;
|
||||
NS_DELETEXPCOM(this);
|
||||
return 0;
|
||||
}
|
||||
return mRefCnt;
|
||||
|
@ -123,17 +123,17 @@ public:
|
|||
}
|
||||
if (aIID.Equals(kIThrobberIID)) {
|
||||
*aInstancePtr = (void*)(nsIThrobber*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIImageObserverIID)) {
|
||||
*aInstancePtr = (void*)(nsIImageRequestObserver*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)(nsIThrobber*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (nsnull != mInnerWidget) {
|
||||
|
@ -333,6 +333,7 @@ nsThrobber::Init(nsIWidget* aParent, const nsRect& aBounds)
|
|||
}
|
||||
else {
|
||||
// Get rid of extra reference count
|
||||
// XXX FIX ME...
|
||||
mWidget->Release();
|
||||
mWidget->Create(aParent, aBounds, HandleThrobberEvent, NULL);
|
||||
}
|
||||
|
@ -549,7 +550,7 @@ nsThrobberFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
AddRef(); // Increase reference count for caller
|
||||
NS_ADDREF_THIS(); // Increase reference count for caller
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -431,44 +431,44 @@ nsWebShell::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
}
|
||||
if (aIID.Equals(kIWebShellIID)) {
|
||||
*aInstancePtr = (void*)(nsIWebShell*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIContentViewerContainerIID)) {
|
||||
*aInstancePtr = (void*)(nsIContentViewerContainer*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIScriptContextOwnerIID)) {
|
||||
*aInstancePtr = (void*)(nsIScriptContextOwner*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDocumentLoaderObserverIID)) {
|
||||
*aInstancePtr = (void*)(nsIDocumentLoaderObserver*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIWebShellContainerIID)) {
|
||||
*aInstancePtr = (void*)(nsIWebShellContainer*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kILinkHandlerIID)) {
|
||||
//I added this for plugin support of jumping
|
||||
//through links. maybe there is a better way... MMP
|
||||
*aInstancePtr = (void*)(nsILinkHandler*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kRefreshURLIID)) {
|
||||
*aInstancePtr = (void*)(nsIRefreshUrl*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)(nsIWebShell*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (nsnull != mInnerWindow) {
|
||||
|
@ -486,12 +486,12 @@ nsWebShell::QueryCapability(const nsIID &aIID, void** aInstancePtr)
|
|||
|
||||
if (aIID.Equals(kILinkHandlerIID)) {
|
||||
*aInstancePtr = (void*) ((nsILinkHandler*)this);
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIScriptContextOwnerIID)) {
|
||||
*aInstancePtr = (void*) ((nsIScriptContextOwner*)this);
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -620,6 +620,7 @@ nsWebShell::Init(nsNativeWidget aNativeParent,
|
|||
mWindow->Create(aNativeParent, aBounds, nsWebShell::HandleEvent,
|
||||
mDeviceContext, nsnull, nsnull, &widgetInit);
|
||||
// Get rid of extra reference count
|
||||
// XXX FIX ME...
|
||||
mWindow->Release();
|
||||
}
|
||||
|
||||
|
@ -1696,7 +1697,7 @@ nsWebShell::CancelRefreshURLTimers(void) {
|
|||
mRefreshments.RemoveElementAt(tmp);
|
||||
if (timer) {
|
||||
timer->Cancel();
|
||||
timer->Release();
|
||||
NS_RELEASE(timer);
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
|
@ -1847,7 +1848,7 @@ nsWebShellFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
AddRef(); // Increase reference count for caller
|
||||
NS_ADDREF_THIS(); // Increase reference count for caller
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1884,7 +1885,7 @@ nsWebShellFactory::CreateInstance(nsISupports *aOuter,
|
|||
goto done;
|
||||
}
|
||||
|
||||
inst = new nsWebShell();
|
||||
NS_NEWXPCOM(inst, nsWebShell);
|
||||
if (inst == NULL) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
goto done;
|
||||
|
|
|
@ -41,17 +41,17 @@ nsresult nsEditorKeyListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMEventListenerIID)) {
|
||||
*aInstancePtr = (void*)(nsIDOMEventListener*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMKeyListenerIID)) {
|
||||
*aInstancePtr = (void*)(nsIDOMKeyListener*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
|
@ -149,17 +149,17 @@ nsresult nsEditorMouseListener::QueryInterface(REFNSIID aIID, void** aInstancePt
|
|||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMEventListenerIID)) {
|
||||
*aInstancePtr = (void*)(nsIDOMEventListener*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMMouseListenerIID)) {
|
||||
*aInstancePtr = (void*)(nsIDOMMouseListener*)this;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
|
|
|
@ -115,7 +115,7 @@ nsresult GetFirstTextNode(nsIDOMNode *aNode, nsIDOMNode **aRetNode)
|
|||
}
|
||||
else if (aNode->TEXT == mType) {
|
||||
*aRetNode = aNode;
|
||||
aNode->AddRef();
|
||||
NS_ADDREF(aNode);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -125,7 +125,7 @@ nsresult nsGetCurrentNode(nsIDOMNode ** aNode)
|
|||
{
|
||||
if (kCurrentNode != nsnull) {
|
||||
*aNode = kCurrentNode;
|
||||
kCurrentNode->AddRef();
|
||||
NS_ADDREF(kCurrentNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ nsresult nsGetCurrentNode(nsIDOMNode ** aNode)
|
|||
NS_RELEASE(mFirstTextNode);
|
||||
NS_RELEASE(mDocNode);
|
||||
*aNode = kCurrentNode;
|
||||
kCurrentNode->AddRef();
|
||||
NS_ADDREF(kCurrentNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ nsresult nsSetCurrentNode(nsIDOMNode * aNode)
|
|||
{
|
||||
NS_IF_RELEASE(kCurrentNode);
|
||||
kCurrentNode = aNode;
|
||||
kCurrentNode->AddRef();
|
||||
NS_ADDREF(kCurrentNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,12 +99,12 @@ nsViewerApp::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
|
|||
}
|
||||
if (aIID.Equals(kINetContainerApplicationIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIBrowserWindow*)this);
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsISupports*)((nsIBrowserWindow*)this));
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
|
@ -275,7 +275,7 @@ NS_IMETHODIMP
|
|||
nsViewerApp::ProcessArguments(int argc, char** argv)
|
||||
{
|
||||
mCrawler = new nsWebCrawler(this);
|
||||
mCrawler->AddRef();
|
||||
NS_ADDREF(mCrawler);
|
||||
|
||||
int i;
|
||||
for (i = 1; i < argc; i++) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче