зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1208814 - Part 2: Don't use the default copy constructor in nsNavHistoryQuery::Clone(), r=ehsan
This commit is contained in:
Родитель
977f9a33ea
Коммит
be661c08ad
|
@ -908,6 +908,19 @@ nsNavHistoryQuery::nsNavHistoryQuery()
|
|||
mDomain.SetIsVoid(true);
|
||||
}
|
||||
|
||||
nsNavHistoryQuery::nsNavHistoryQuery(const nsNavHistoryQuery& aOther)
|
||||
: mMinVisits(aOther.mMinVisits), mMaxVisits(aOther.mMaxVisits),
|
||||
mBeginTime(aOther.mBeginTime),
|
||||
mBeginTimeReference(aOther.mBeginTimeReference),
|
||||
mEndTime(aOther.mEndTime), mEndTimeReference(aOther.mEndTimeReference),
|
||||
mSearchTerms(aOther.mSearchTerms), mOnlyBookmarked(aOther.mOnlyBookmarked),
|
||||
mDomainIsHost(aOther.mDomainIsHost), mDomain(aOther.mDomain),
|
||||
mUriIsPrefix(aOther.mUriIsPrefix), mUri(aOther.mUri),
|
||||
mAnnotationIsNot(aOther.mAnnotationIsNot),
|
||||
mAnnotation(aOther.mAnnotation), mTags(aOther.mTags),
|
||||
mTagsAreNot(aOther.mTagsAreNot), mTransitions(aOther.mTransitions)
|
||||
{}
|
||||
|
||||
NS_IMETHODIMP nsNavHistoryQuery::GetBeginTime(PRTime *aBeginTime)
|
||||
{
|
||||
*aBeginTime = mBeginTime;
|
||||
|
@ -1321,11 +1334,10 @@ NS_IMETHODIMP nsNavHistoryQuery::Clone(nsINavHistoryQuery** _retval)
|
|||
{
|
||||
*_retval = nullptr;
|
||||
|
||||
nsNavHistoryQuery *clone = new nsNavHistoryQuery(*this);
|
||||
nsRefPtr<nsNavHistoryQuery> clone = new nsNavHistoryQuery(*this);
|
||||
NS_ENSURE_TRUE(clone, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
clone->mRefCnt = 0; // the clone doesn't inherit our refcount
|
||||
NS_ADDREF(*_retval = clone);
|
||||
clone.forget(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class nsNavHistoryQuery final : public nsINavHistoryQuery
|
|||
{
|
||||
public:
|
||||
nsNavHistoryQuery();
|
||||
// note: we use a copy constructor in Clone(), the default is good enough
|
||||
nsNavHistoryQuery(const nsNavHistoryQuery& aOther);
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_NAVHISTORYQUERY_IID)
|
||||
NS_DECL_ISUPPORTS
|
||||
|
|
Загрузка…
Ссылка в новой задаче