summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qscopedpointer.h
Commit message (Collapse)AuthorAgeFilesLines
* QScopedArrayPointer: document the most important ctorMarc Mutz2017-06-061-9/+4
| | | | | | | | | | | | The ctor that everyone would want to use was marked as \internal, probably because of the SFINAE expression appearing in its signature. Move the SFINAE to the template argument list, which QDoc hides from the user, and drop the \internal. While at it, drop the home-grown std::is_same re-implementation and use the real deal. Change-Id: Ia357fe65f94e10ac9eeccb3490aa8b3e68114cbb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QSharedPointer/QWeakPointer/QScopedPointer: add comparison against nullptrGiuseppe D'Angelo2016-06-081-0/+24
| | | | | | | | Some constructors were added, but the comparison operators were missing. The STL has them, so we ought have them too. Change-Id: I030c14a3b355988f509716b4b1b1a835b3ab9481 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QSharedPointer/QWeakPointer/QScopedPointer: plaster API with Q_DECL_NOTHROWGiuseppe D'Angelo2016-06-071-11/+10
| | | | | | | Some methods were already marked, this adds noexcept to even more methods. Change-Id: I420bb1cc985058c7976ce3a1f251fadbba7ddceb Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QScoped(Array)Pointer: canonicalize swappingMarc Mutz2016-05-041-11/+9
| | | | | | | | | | | | | | | | | | | | This includes: - have nothrow member-swap - have ADL non-member swap - not specialize qSwap or std::swap Also prevent QScopedPointer <-> QScopedArrayPointer swaps by overloading swap (both member and non-member) on QScopedArrayPointer. It's not 100% safe, but it's what we're doing elsewhere (QMulti(Map,Hash), say). That's technically a SiC change if users expected (qualified) std::swap to invoke QScopedPointer::swap(), but those users were doing it wrong to begin with, and they now get a compile-error instead of silent pessimization, because generic std::swap() doesn't work on QScopedPointer, due to lack of copy (and thus move) semantics. Change-Id: I3ab5c1668722a2c8ccafc16f57310ce8d4bffbd6 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QtCore: Use Q_NULLPTR instead of 0 in smart pointer headersMarc Mutz2015-07-181-7/+7
| | | | | | | | | | | This is in preparation of adding -Wzero-as-null-pointer-constant (or similar) to the headers check. Not caught by the headersclean check, because they are in template code. Task-number: QTBUG-45291 Change-Id: I7294404225a19a1c58f91e6e47a9d650179ea83c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Revert "Implement move-ctor and move-assignment-op for QScopedPointer"Stephen Kelly2013-09-051-13/+0
| | | | | | | | | | | | | | | This reverts commit 5b9006bbdba7dcab01b8e640554a7d7a4b64f76b. Also revert "Doc: Enable documentation for QScopedPointer's rvalue ref functions" This reverts commit 5f8416ec659b134db90df7e7f857db77fd27b6ab. Adding a move contructor to QScopedPointer makes no sense, because moving means 'escaping the scope', which breaks the fundamental point of QScopedPointer. Change-Id: I4ac1b108bf199af6e436fa1629aa2d3b93c27724 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* add QScopedPointerDeleteLater, a custom deleter for QObjectsMatt Broadstone2013-08-121-0/+11
| | | | | | | | | | This is a custom deleter for QObjects that are participating in an event loop (e.g. waiting for signals to complete a task), which need to be deleted using deleteLater() rather than just delete. Change-Id: I3084ea28a6829a299c7400006c617fc23cf15160 Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Implement move-ctor and move-assignment-op for QScopedPointerGiuseppe D'Angelo2013-07-281-0/+13
| | | | | | | | | | | | | | | | | | | | | It makes sense for a QScopedPointer to be movable, for instance for allowing instances to be returned from a function. Ownwership of the managed pointer is still tied to one (and one only) QScopedPointer instance. Moreover, a move assignment operator makes sense as well, as it implementing the equivalent of this->reset(other.take()); only when other is a rvalue and not a lvalue (so either it's a temporary or it's getting explicitly moved in with std::move). This makes QScopedPointer API's a bit closer to std::unique_ptr's one. Task-number: QTBUG-29754 Change-Id: If1ac0c688327a67af4ad5b7ad45b439b022ed1c6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-291-2/+0
| | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵Frederik Gladhorn2013-01-231-1/+1
|\ | | | | | | refs/staging/dev
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | | | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Don't clear the pointer in QScopedPointer's destructorThiago Macieira2013-01-231-1/+0
|/ | | | | | | | | | | | | | | | | It helps in valgrinding applications. It's the difference between: ==17609== Address 0x38 is not stack'd, malloc'd or (recently) free'd and ==19789== Address 0x598f478 is 56 bytes inside a block of size 112 free'd ==19789== at 0x4A0736C: operator delete(void*) (vg_replace_malloc.c:480) ==19789== by 0x53A77CD: QObjectPrivate::~QObjectPrivate() (qobject.cpp:239) ==19789== by 0x53B4EB5: QScopedPointerDeleter<QObjectData>::cleanup(QObjectData*) (qscopedpointer.h:63) ==19789== by 0x53B3980: QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::~QScopedPointer() (qscopedpointer.h:99) ==19789== by 0x53A8EEC: QObject::~QObject() (qobject.cpp:750) Change-Id: If42107c94401a96c05caa511442d6bd010fd4e29 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Remove references to QT_NO_STL from QtCoreThiago Macieira2012-04-071-2/+0
| | | | | | | | QT_NO_STL is now no longer defined, so remove the conditionals and select the STL side. Change-Id: Ieedd248ae16e5a128b4ac287f850b3ebc8fb6181 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Remove all calls to, and deprecate qMalloc, qRealloc and qFree.Robin Burchell2012-03-311-1/+3
| | | | | | | | | | | | | | | | | | Callers should just call the standard allocation functions directly. Adding an extra function call onto all basic memory management for the sake of making it instrumentable in rare cases isn't really fair to everyone else. What's more, this wasn't completely reliable, as not everything was using them in a number of places. Memory management can still be overridden using tricks like LD_PRELOAD if needed. Their aligned equivilents cannot be deprecated, as no standard equivilents exist, although investigation into posix_memalign(3) is a possibility for the future. Change-Id: Ic5f74b14be33f8bc188fe7236c55e15c36a23fc7 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove use of QT_MODULE from libraryGunnar Sletta2012-01-251-1/+0
| | | | | | | | | | These defines were there to aid in the commercial licensing scheme we used long ago, and are no longer needed. Keep a QT_MODULE(x) define so other modules continue compiling. Change-Id: I8fd76cd5270df8f14aee746b6cf32ebf7c23fec7 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove Q_CC_NOKIAX86.Robin Burchell2012-01-191-3/+1
| | | | | | | | This is no longer supported. Change-Id: Ic393bc48c4c842514da69b6696cfb62b54360070 Reviewed-by: Jonas Gastal <jgastal@profusion.mobi> Reviewed-by: Shane Kearns <ext-shane.2.kearns@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix QScopedPointerarray default constructorOlivier Goffart2011-07-051-1/+3
| | | | | | | | | | | | | | Since the compiler cannod find the template argument if there is no argument passed to the constructor, this effectively means there is no default constructor. Add a default constructor Task-number: QTBUG-20256 Change-Id: I310d5e1f3f94a8fe69fd3a5c46f2f51bca60facd Reviewed-on: http://codereview.qt.nokia.com/1165 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+245
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12