summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qsharedpointer_impl.h
Commit message (Collapse)AuthorAgeFilesLines
* Change qHash() to work with size_t instead of uintLars Knoll2020-04-091-1/+1
| | | | | | | | | | | This is required, so that QHash and QSet can hold more than 2^32 items on 64 bit platforms. The actual hashing functions for strings are still 32bit, this will be changed in a follow-up commit. Change-Id: I4372125252486075ff3a0b45ecfa818359fe103b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-10-241-31/+20
|\ | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qstandardpaths_unix.cpp src/corelib/tools/qsharedpointer_impl.h tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp Change-Id: Iae95c5778dc091058f16f6db76f04a0178a9e809
| * Q{Shared,Weak}Pointer: Reduce overload sets in implicit conversionsMilian Wolff2019-10-111-31/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only allow implicit conversions when the types involved are compatible. That means, only allow construction and copy assignment when the type X* is convertible to type T*. This is done using SFINAE and the std::is_convertible type trait, which makes the previous QSHAREDPOINTER_VERIFY_AUTO_CAST obsolete. This patch fixes compilation when a function is overloaded with Q{Shared,Weak}Pointer of different, incompatible types. Previously, this resulted in a compilation error due to an ambiguous overload. Change-Id: I069d22f3582e69842f14284d4f27827326597ca2 Fixes: QTBUG-75222 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Port from QAtomic::load() to loadRelaxed()Giuseppe D'Angelo2019-06-201-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Semi-automated, just needed ~20 manual fixes: $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)load\(\)/$1loadRelaxed\(\)/g' -i \{\} + $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)store\(/$1storeRelaxed\(/g' -i \{\} + It can be easily improved (e.g. for store check that there are no commas after the opening parens). The most common offender is QLibrary::load, and some code using std::atomic directly. Change-Id: I07c38a3c8ed32c924ef4999e85c7e45cf48f0f6c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QWeakPointer: use an alternative work-round for internalData() usersMarc Mutz2019-06-111-11/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous work-around fails, probably because of cross-dependencies. E.g. we have this in QtScXml: In file included from /home/qt/work/install/include/QtCore/qsharedpointer.h:48:0, from ../../src/scxml/qscxmltabledata_p.h:55, from ../../src/scxml/qscxmltabledata.cpp:40: /home/qt/work/install/include/QtCore/qsharedpointer_impl.h:687:12: error: ‘QPointer’ does not name a type; did you mean ‘pointer’? friend QPointer<X> ^~~~~~~~ pointer /home/qt/work/install/include/QtCore/qsharedpointer_impl.h:689:23: error: ‘QSmartPointerConvertFunctor’ in namespace ‘QtPrivate’ does not name a template type friend QtPrivate::QSmartPointerConvertFunctor<QWeakPointer>; ^~~~~~~~~~~~~~~~~~~~~~~~~~~ To fix, grand friendship only to a non-template class with a templated static method that returns internalData(). This fixes most users, except in qmetatype.h, which does not include qsharedpointer.h. In order to use the non-template class in there, we need to delay its name lookup to instantiation time. We do this by artificially making it a dependent name, by using a class template that inherits from our befrieded class. Change-Id: I12b427f1fe9503df819ea5436d780972d6402e68 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* | QSharedPointer: Fix build error for cross-built toolsFriedemann Kleint2019-05-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Guard friend declaration within QT_NO_QOBJECT. Amends 28ce318fcbccb5a117ca4e55322ee1c1dd8d05d4. Fixes: QTBUG-76056 Change-Id: I14fbe5457c16e8a366fecdc0a356b68b8609848b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | QtPrivate::QSmartPointerConvertFunctor: Fix deprecation warningFriedemann Kleint2019-05-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | Fix warning: src/corelib/kernel/qmetatype.h:1723:27: warning: ‘T* QWeakPointer<T>::data() const [with T = QFile]’ is deprecated: Use toStrongRef() instead, and data() on the returned QSharedPointer [-Wdeprecated-declarations] shown when compiling tst_QVariant by using QWeakPointer::internalData(). Change-Id: I5ea543019b4f8e5dfc829939cd2011ae65f12876 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Cleanup the fallout of QWeakPointer::data() deprecationGiuseppe D'Angelo2019-05-171-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are still users of QWeakPointer::data(), which under certain compilers will make headersclean fail. So this patch: * ports data() to a private internalData() function and calls it from all the usage points; * adds cleanup notes for Qt 6, once some of the deprecated machinery around storing unmanaged QObjects in QWeakPointers can get removed. Change-Id: Id3bcbd23374c18a2026861c08a4dcba1670673c1 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Mike Krus <mike.krus@kdab.com>
* | Deprecate QWeakPointer::data()Giuseppe D'Angelo2019-05-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | It's a dangerous API to have. Upgrade to a shared pointer if accessing the raw pointer is required. [ChangeLog][QtCore][QWeakPointer] The data() function has been deprecated. Change-Id: Ie5d34f4fb500b3cfa14d2c0b1b08484df072129c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | QSharedPointer/QWeakPointer: fix swap()Giuseppe D'Angelo2019-05-111-12/+6
| | | | | | | | | | | | | | | | Do not specialize std::swap, just add swap in Qt's namespace. Also add swap() for QWeakPointer, and sprinkle noexcept. Change-Id: Ifb06c214f1865d42f3f2cddf5f980aede6bde185 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Remove handling of missing =delete and =default supportAllan Sandfeld Jensen2019-05-021-8/+4
| | | | | | | | | | Change-Id: I006dfd0b7cfa3bda5e5ab01bcefa851f031dfe0e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Remove handling of missing Q_COMPILER_RVALUE_REFSAllan Sandfeld Jensen2019-05-011-5/+0
| | | | | | | | | | | | | | | | Remove remaining handling of missing support for rvalue refs. Change-Id: I78bab8bccfeeb9c76f464f345874364a37e4840a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add qobject_cast operators for std::shared_ptrGiuseppe D'Angelo2019-05-011-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | Mimicking what we currently have for QSharedPointer, but also adding * snake_case version (matching the ones in std) * rvalue-overloaded versions (matching the C++2a overloads). [ChangeLog][QtCore][QSharedPointer] Overloads of qSharedPointerObjectCast have been added to work on std::shared_ptr. Change-Id: I26ddffd82b000bf876e7c141fdce86a7b8c1d75a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Replace Q_DECL_NOEXCEPT with noexcept in corelibAllan Sandfeld Jensen2019-04-031-49/+49
|/ | | | | | | In preparation of Qt6 move away from pre-C++11 macros. Change-Id: I44126693c20c18eca5620caab4f7e746218e0ce3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add support for QSharedPointer<cv qualified>::create()Thiago Macieira2018-05-171-4/+7
| | | | | | | | | | [ChangeLog][QtCore][QSharedPointer] Fixed a problem that made create() on a type with const qualification fail to compile. Task-number: QTBUG-68300 Change-Id: I0825ff5b5f6f4c85939ffffd152f3e55e5b9caae Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-09-261-3/+6
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qguiapplication.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h src/plugins/platforms/cocoa/qcocoawindow.h src/testlib/qtestsystem.h Change-Id: I5975ffb3261c2dd82fe02ec4e57df7c0950226c5
| * QSharedPointer: fix undefined behavior in operator<Giuseppe D'Angelo2017-09-171-3/+6
| | | | | | | | | | | | | | | | Pointers belonging to different arrays must be compared using std::less. Change-Id: Ib77af7b1b2da58d7243fa77273a8a45ee9035a1a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Replace Q_NULLPTR with nullptr where possibleKevin Funk2017-09-191-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QSharedPointer: add get() for STL compatibilityGiuseppe D'Angelo2017-09-121-0/+1
|/ | | | | | | | [ChangeLog][QtCore][QSharedPointer] Added get(), for compatibility with std::shared_ptr. Change-Id: I77189c89bc6a222313b9b2353f1fb3969433c750 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-04-181-1/+4
|\ | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp Change-Id: I375fa4afa662fa411a15f212ebd5f2f0dffdba7f
| * Fix undefined behavior in QSharedPointer::create()5.8Ihor Dutchak2017-04-171-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Initialize a deleter for a new object, created by QSharedPointer::create(), only after the object is actually constructed. [ChangeLog][QtCore][QSharedPointer] Fixed undefined behavior when creating an object with QSharedPointer::create() and its conscructor throws an exception. Task-number: QTBUG-49824 Change-Id: I07f77a78ff468d9b45b8ef133278e8cdd96a0647 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Use std::enable_if instead of QEnableIfAlexander Volkov2017-01-271-2/+2
|/ | | | | | Change-Id: Ideca8283141484cb6da47c50333f5c96e416f082 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Replace custom type traits with std one'sKai Koehne2016-11-081-1/+1
| | | | | | | | | | | | | | | | | | Remove most type traits from qtypetraits.h, but keep the custom implementation of is_signed/is_unsigned. This gets rid of BSD-3 licensed code from Google in a public header (hugh!). The custom implementations for is_signed/is_unsigned are kept because the implementations in gcc's standard headers do not work as we expect for enums - both is_signed and is_unsigned always returns false there - see also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59027 [ChangeLog][QtCore][General] Qt now relies on type traits from the C++ standard library. Change-Id: I3f2188b46949f04ca4482a6ac9afd3482103f0e1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSharedPointer: clean up #ifdefsMarc Mutz2016-08-151-48/+0
| | | | | | | | | | | We require Q_COMPILER_RVALUE_REFS and _VARIADIC_TEMPLATES since Qt 5.7, so remove the non-variadic version which anyway has zero test coverage. Also drop #include <utility>, as that is included from qglobal.h already, and drop QSKIP from test. Change-Id: I1fc7f7068eac80ad6fd85e1d8f6d33c5c7bb67db Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Merge remote-tracking branch 'origin/5.7' into devEdward Welbourne2016-08-011-6/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure 5.7 now supports clang on android; but dev re-worked configure src/gui/kernel/qevent.h One side renamed a parameter of a constructor; the other added an alternate constructor on the next line. Applied the rename to both for consistency. tests/auto/tools/moc/tst_moc.cpp Each side added a new test at the end. .qmake.conf Ignored 5.7's change to MODULE_VERSION. configure.json No conflict noticed by git; but changes in 5.7 were needed for the re-worked configure to accommodate 5.7's stricter handling of C++11. Change-Id: I9cda53836a32d7bf83828212c7ea00b1de3e09d2
| * Merge remote-tracking branch 'origin/5.6' into 5.7Edward Welbourne2016-07-261-6/+6
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qtemporarydir.cpp One side encapsulated a repeated piece of #if-ery in a local define; the other added to the #if-ery. Made its addition to the other's. src/corelib/kernel/qeventdispatcher_unix_p.h One side moved some members into a struct; this collided with a #undef check that neither side now has. Discarded the #undef part. src/gui/opengl/qopengltexturehelper_p.h 5.7 deleted a bunch of methods; not clear why merge got confused. src/tools/moc/moc.cpp One added a name to the copyright header; another changed its URL. Change-Id: I9e9032b819f030d67f1915445acf2793e98713fa
| | * Work around ICC bug about shadowing declarations that aren't shadowingThiago Macieira2016-07-241-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Known ICC bug, still present in version 17 beta. qdatetime.h(126): error #3280: declaration hides member "QDate::jd" (declared at line 136) Obviously a parameter to static function or to a function in a nested class can't shadow an NSDM. Intel issue IDs: 0000698329 / DPD200245740 Change-Id: I149e0540c00745fe8119fffd1463c679a3a9c8c3 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | QSharedPointer/QWeakPointer/QScopedPointer: add comparison against nullptrGiuseppe D'Angelo2016-06-081-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | 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-23/+23
| | | | | | | | | | | | | | | | | | | | | Some methods were already marked, this adds noexcept to even more methods. Change-Id: I420bb1cc985058c7976ce3a1f251fadbba7ddceb Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-05-231-11/+0
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/wince80colibri-armv7-msvc2012/qmake.conf qmake/generators/win32/msvc_vcproj.cpp src/corelib/global/qnamespace.h src/corelib/global/qnamespace.qdoc src/corelib/io/qfsfileengine_win.cpp src/corelib/tools/tools.pri src/network/ssl/qsslconfiguration_p.h src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp src/plugins/platforms/windows/windows.pri src/src.pro src/tools/bootstrap/bootstrap.pro src/tools/uic/cpp/cppwriteinitialization.cpp src/widgets/dialogs/qfilesystemmodel.cpp tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt Change-Id: I4d2ac78f0dcc97f008186bbbc769c6fe588ab0e5
| * | QSharedPointer: move QDebug stream operators into qdebug.hGiuseppe D'Angelo2016-05-121-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | In order to avoid pulling in QDebug when including QSharedPointer. Change-Id: I14b86d1f100ed44a68258c91bbda394b655bac83 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Make QSharedPointer without custom deleters call the correct destructorThiago Macieira2016-04-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Where "correct" is defined by what std::shared_ptr does as well as what happens when an intermediate QSharedPointer of the exact type of the constructor behaves That is, QSharedPointer<X> ptr(new Y); Behaves like QSharedPointer<X> ptr; { QSharedPointer<Y> tmp(new Y); ptr = tmp; } Change-Id: Id75834dab9ed466e94c7ffff14455d445f72592b Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | Add support for initializing QSharedPointer from nullptrThiago Macieira2016-04-191-4/+10
|/ / | | | | | | | | | | | | | | | | | | std::shared_ptr supports it. To resolve an ambiguous overload when a literal 0 is passed as a parameter, the normal constructors needed to be made a template, like std::shared_ptr. Task-number: QTBUG-52569 Change-Id: Id75834dab9ed466e94c7ffff14451417892d2148 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-181-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also reverts commit 018e670a26ff5a61b949100ae080f5e654e7bee8. The change was introduced in 5.6. After the refactoring, 14960f52, in 5.7 branch and a merge, it is not needed any more. Conflicts: .qmake.conf src/corelib/io/qstandardpaths_mac.mm src/corelib/tools/qsharedpointer_impl.h tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp Change-Id: If4fdff0ebf2b9b5df9f9db93ea0022d5ee3da2a4
| * Fix QT_DEPRECATED_SINCE usageJędrzej Nowacki2016-02-021-1/+1
| | | | | | | | | | | | | | | | The deprecation was introduced in 5.6 Change-Id: Ief6b749b40ec75c3c9f904caed8447bfb5ef5439 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Add Intel copyright to files that Intel has had non-trivial contributionThiago Macieira2016-01-211-0/+1
| | | | | | | | | | | | | | | | | | I wrote a script to help find the files, but I reviewed the contributions manually to be sure I wasn't claiming copyright for search & replace, adding Q_DECL_NOTHROW or adding "We mean it" headers. Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.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>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-12-181-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/painting/painting.pri src/plugins/platforms/xcb/qxcbconnection.cpp tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro tests/auto/corelib/tools/qlocale/test/test.pro tests/auto/gui/kernel/qwindow/tst_qwindow.cpp tools/configure/environment.cpp Change-Id: I9c40f458b89b2c206de2d2c24e90b5f679c93495
| * Fix constructing a QSharedPointer<const> of a QEnableSharedFromThis typeThiago Macieira2015-12-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | It should compile, since the std::shared_ptr does. [ChangeLog][QtCore][QSharedPointer] Fixed a problem that would cause a compilation error when constructing a QSharedPointer of a const type when the type derives from QEnableSharedFromThis. Task-number: QTBUG-49748 Change-Id: I8de47ed6c7be4847b99bffff141c84f5e0b6bea8 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QWeakPointer: enable move semanticsMarc Mutz2015-10-071-0/+10
| | | | | | | | | | | | | | | | Also add some tests for QSharedPointer move semantics, too. Change-Id: I1bdd1fe140acafabe5bc6bff8af49a053ec1f4d5 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QWeakPointer: mark as nothrow {default,copy} {constructible,assignable}Marc Mutz2015-09-131-5/+6
| | | | | | | | | | Change-Id: I6757a775c72f15c210004dc25d962ec5d3b88012 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QSharedPointer: mark as nothrow {default,move,copy}{constructible,assignable}Marc Mutz2015-09-131-5/+5
| | | | | | | | | | Change-Id: Ieae2c5ff6db1a475269034f0bd9cbd903dd3c72a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Implement QDebug support for QSharedPointerGiuseppe D'Angelo2015-09-031-0/+11
|/ | | | | | | | | | | | ... otherwise the type goes through operator bool() and prints "true" or "false" (!). [ChangeLog][QtCore][QSharedPointer] Added support for debug printing via QDebug. Change-Id: Ic3ef9b9feee8d6ca08f1dd69f20f421fea20ca00 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSharedPointer: make copy assignment from compatible shared pointer use ↵Marc Mutz2015-07-211-14/+2
| | | | | | | | | | | copy-swap ... like all other assignment operators. Removes the last user of internalCopy(). Removed. Change-Id: I15f2cb3b7b26988dd3bc2f4475bc316480476993 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSharedPointer: add move construction, assignment from compatible shared ↵Marc Mutz2015-07-191-0/+17
| | | | | | | pointers Change-Id: I772c568055c9bed6eb627ad35dba300925fc0fde Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSharedPointer: mark some internal API nothrowMarc Mutz2015-07-191-4/+4
| | | | | Change-Id: I871c86406b2c25df9a7834a997caf8a792d353a0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtCore: Use Q_NULLPTR instead of 0 in smart pointer headersMarc Mutz2015-07-181-16/+16
| | | | | | | | | | | 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>
* QWeakPointer: remove misleading Q_DECL_CONSTEXPRMarc Mutz2015-06-281-1/+1
| | | | | | | | | | Adding constexpr there is allowed, because QWeakPointer is a class template. But in 100% of cases, it will be dropped, because the destructor is not trivial. So, don't mislead users and devs to think that any or even all QWeakPointers could ever be constexpr. Change-Id: Ia50aad4d6c4fb724254308150124c666e82ef817 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QSharedPointer: destroy LHS on move assignmentMarc Mutz2015-06-271-1/+2
| | | | | | | | | | | | | | | | | Howard Hinnant is right: just swapping may keep a resource alive too long. The problem with replacing swap(other) was that the naïve approach: clear(); swap(other); is not safe for self-assignment. Taking a cue from the default std::swap() implementation, and the copy-swap idiom, a self-assignment-safe version is QSharedPointer moved(std::move(other)); swap(moved); which is to what I changed the implementation now. Change-Id: I589fdae50ae22b95350db8250b02d983dc8487a6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace <qhash.h> with <qhashfunctions.h> where applicableMarc Mutz2015-04-201-1/+4
| | | | | | | | To avoid source-incompatibilites, wrap in QT_DEPRECATED_SINCE(5, 5) in public headers. Change-Id: Ic3398f4f330e15a3b55065858add26b90fd70e6c Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>