From da8bcd722d15fce9f9ca15665a3428eb8f6bf6b8 Mon Sep 17 00:00:00 2001 From: "beard%netscape.com" Date: Fri, 14 May 1999 22:45:46 +0000 Subject: [PATCH] Fixed some serious ref count bugs using nsIURL when instantiating plugins. git-svn-id: svn://10.0.0.236/trunk@31680 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsObjectFrame.cpp | 15 +++++++++------ mozilla/layout/html/base/src/nsObjectFrame.cpp | 15 +++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index a239122b86e..2f831a61e2b 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -789,6 +789,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext, if(!fullURL && baseURL) { SetFullURL(baseURL); fullURL = baseURL; + NS_IF_ADDREF(fullURL); } nsIView *parentWithView; nsPoint origin; @@ -886,7 +887,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext, nsIPluginHost *pluginHost = nsnull; nsIContentViewerContainer *cv = nsnull; nsIURL* baseURL = nsnull; - nsIURL* fullURL = nsnull; + nsIURL* fullURL = nsnull; nsAutoString classid; PRInt32 nameSpaceID; @@ -938,7 +939,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext, else { fullURL = baseURL; - NS_ADDREF(fullURL); + NS_IF_ADDREF(fullURL); } NS_IF_RELEASE(group); @@ -1000,9 +1001,10 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext, NS_IF_RELEASE(baseURL); baseURL = codeBaseURL; } - } - else + } else { fullURL = baseURL; + NS_IF_ADDREF(fullURL); + } NS_IF_RELEASE(group); @@ -1140,9 +1142,10 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext, // Create an absolute URL rv = NS_NewURL(&fullURL, src, baseURL, nsnull, group); NS_IF_RELEASE(group); - } - else // we didn't find a src or data param, so just set the url to the base + } else {// we didn't find a src or data param, so just set the url to the base fullURL = baseURL; + NS_IF_ADDREF(fullURL); + } // if we didn't find the type, but we do have a src, we can determine the mimetype // based on the file extension diff --git a/mozilla/layout/html/base/src/nsObjectFrame.cpp b/mozilla/layout/html/base/src/nsObjectFrame.cpp index a239122b86e..2f831a61e2b 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.cpp +++ b/mozilla/layout/html/base/src/nsObjectFrame.cpp @@ -789,6 +789,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext, if(!fullURL && baseURL) { SetFullURL(baseURL); fullURL = baseURL; + NS_IF_ADDREF(fullURL); } nsIView *parentWithView; nsPoint origin; @@ -886,7 +887,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext, nsIPluginHost *pluginHost = nsnull; nsIContentViewerContainer *cv = nsnull; nsIURL* baseURL = nsnull; - nsIURL* fullURL = nsnull; + nsIURL* fullURL = nsnull; nsAutoString classid; PRInt32 nameSpaceID; @@ -938,7 +939,7 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext, else { fullURL = baseURL; - NS_ADDREF(fullURL); + NS_IF_ADDREF(fullURL); } NS_IF_RELEASE(group); @@ -1000,9 +1001,10 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext, NS_IF_RELEASE(baseURL); baseURL = codeBaseURL; } - } - else + } else { fullURL = baseURL; + NS_IF_ADDREF(fullURL); + } NS_IF_RELEASE(group); @@ -1140,9 +1142,10 @@ nsObjectFrame::Reflow(nsIPresContext& aPresContext, // Create an absolute URL rv = NS_NewURL(&fullURL, src, baseURL, nsnull, group); NS_IF_RELEASE(group); - } - else // we didn't find a src or data param, so just set the url to the base + } else {// we didn't find a src or data param, so just set the url to the base fullURL = baseURL; + NS_IF_ADDREF(fullURL); + } // if we didn't find the type, but we do have a src, we can determine the mimetype // based on the file extension