GetWidget and SetWidget weren't doing proper AddRef and Release. Fixed the

code.


git-svn-id: svn://10.0.0.236/trunk@14749 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
hyatt%netscape.com
1998-11-16 20:39:09 +00:00
parent 44a586b358
commit 018a52aac8
2 changed files with 10 additions and 14 deletions

View File

@@ -26,6 +26,7 @@
*/
#include "nsIDMWidget.h"
#include "nsRDFDataModel.h"
#include "nsRDFDataModelItem.h"
#include "nsIRDFDataBase.h"
@@ -180,20 +181,20 @@ nsRDFDataModel::InitFromResource(nsIDMItem* pItem)
NS_IMETHODIMP
nsRDFDataModel::GetDMWidget(nsIDMWidget*& widget) const
{
widget = GetWidget();
NS_IF_ADDREF(mWidget);
widget = mWidget;
return NS_OK;
}
NS_IMETHODIMP
nsRDFDataModel::SetDMWidget(nsIDMWidget* widget)
{
SetWidget(widget);
return NS_OK;
NS_IF_ADDREF(widget);
NS_IF_RELEASE(mWidget);
mWidget = widget;
return NS_OK;
}
NS_IMETHODIMP
nsRDFDataModel::GetStringPropertyValue(nsString& value, const nsString& property) const
{

View File

@@ -81,14 +81,6 @@ public:
return mRoot;
}
nsIDMWidget* GetWidget(void) const {
return mWidget;
}
void SetWidget(nsIDMWidget* widget) {
mWidget = widget;
}
RDF_Resource GetArcProperty(void) const {
return mArcProperty;
}
@@ -97,6 +89,9 @@ public:
return mArcType;
}
// Internal accessor for the widget. Just wraps a member variable access.
nsIDMWidget* GetWidget() { return mWidget; }
virtual NS_METHOD
CreateItem(RDF_Resource r, nsRDFDataModelItem*& result) = 0;
};