From 612a01be6513894ab1ec5a36b699a2142ba7f35c Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 1 Nov 2020 16:53:26 +0100 Subject: Deprecate QScopedPointer::take() We've decided that QScopedPointer shouldn't be movable, because it would break the semantics of being "scoped" (the pointer/pointee won't survive the scope). Then, QScopedPointer shouldn't allow for take() either. If you need those semantics, reach for unique_ptr. [ChangeLog][QtCore][QScopedPointer] The take() function has been deprecated. This was an API mistake, as it allowed the pointer/pointee to escape from the scope, defeating the point of the QScopedPointer class. If you need such semantics, use std::unique_ptr (and call release()). Change-Id: I3236f085f763b04eb98e3242abc06f7c54fb3d8b Reviewed-by: Thiago Macieira --- src/xml/dom/qdom.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/xml/dom') diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 585e6875e2..b7c676dd09 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -62,6 +62,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -2554,7 +2555,7 @@ QDomNamedNodeMapPrivate::~QDomNamedNodeMapPrivate() QDomNamedNodeMapPrivate* QDomNamedNodeMapPrivate::clone(QDomNodePrivate* p) { - QScopedPointer m(new QDomNamedNodeMapPrivate(p)); + std::unique_ptr m(new QDomNamedNodeMapPrivate(p)); m->readonly = readonly; m->appendToParent = appendToParent; @@ -2567,7 +2568,7 @@ QDomNamedNodeMapPrivate* QDomNamedNodeMapPrivate::clone(QDomNodePrivate* p) // we are no longer interested in ownership m->ref.deref(); - return m.take(); + return m.release(); } void QDomNamedNodeMapPrivate::clearMap() -- cgit v1.2.3