summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qsharedpointer.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* | Use Q_UNLIKELY for every qFatal()/qCritical()Marc Mutz2015-11-291-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If, after checking a condition, we issue a qFatal() or a qCritical(), by definition that check is unlikely to be true. Tell the compiler so it can move the error handling code out of the normal code path to increase the effective icache size. Moved conditional code around where possible so that we could always use Q_UNLIKELY, instead of having to revert to Q_LIKELY here and there. In some cases, simplified the expressions newly wrapped in Q_UNLIKELY as a drive-by. Change-Id: I67537d62b04bc6977d69254690c5ebbdf98bfd6d Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.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>
* 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>
* Doc: Use title case in section1 titlesNico Vertriest2014-09-301-1/+1
| | | | | | | | Using Python script title-cased.py Task-number: QTBUG-41250 Change-Id: I00d3d7a0b30db7304a7904efd6d63abd9a7b493b Reviewed-by: Topi Reiniö <topi.reinio@digia.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>
* Doc: corrected autolink errors qtbase/corelib/toolsNico Vertriest2014-09-241-1/+1
| | | | | | | | | Also corrected some minor language/spelling issues Task-number: QTBUG-40362 Change-Id: I00d76521fc9beb4e7a4a83ff6dc3334a055a7148 Reviewed-by: Topi Reiniö <topi.reinio@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Tidy up and expand QSharedPointer documentation.Mitch Curtis2014-07-031-3/+24
| | | | | | | | Also adds the 5.4.0 changes file. Change-Id: I10967ca179b91229e7d1ee0fc666bbd8dbe54425 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QEnableSharedFromThis classRoman Pasechnik2014-06-291-0/+54
| | | | | | | | | It enables you to get a valid QSharedPointer instance to 'this', when all you have is 'this'. Task-number: QTBUG-7287 Change-Id: I3ed1c9c4d6b110fe02302312cc3c4a75e9d95a0c Reviewed-by: Richard J. Moore <rich@kde.org>
* QSharedPointer: allow one create() argument in C++98, tooMarc Mutz2014-04-071-3/+9
| | | | | | | | | | Survey says that most uses of QSharedPointer(T*) in Qt that could benefit from variadic create() pass only a single argument. In order to prevent all such uses from #ifdef'ing on the complex condition that enables the variadic version, provide a single-argument version (for lvalues only, obviously) for C++98, too. Change-Id: I22ad251a20bbf80867cc31eaa3bcec677bde4359 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QWeakPointer: add member-swapMarc Mutz2014-04-031-0/+8
| | | | | | | | [ChangeLog][QtCore][QWeakPointer] Added member-swap function. Change-Id: Ide3672dc74a9d8153e5f930290d938e8c23993b5 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QWeakPointer: add lock() for std::weak_ptr compatibilityMarc Mutz2014-04-031-0/+9
| | | | | | | [ChangeLog][QtCore][QWeakPointer] Added lock() method for std::weak_ptr compatibility. Change-Id: I0851d91c51f5a4f04a855a1d8082234ce38396b4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: document QSharedPointer::swap() methodMarc Mutz2014-03-171-0/+8
| | | | | | | | | | The function is already present for quite some time, but was never documented, so declare it as \since 5.3. Add swap() function to qsharedpointer.h so it's visible to QDoc, too. Change-Id: I8eba420878a096392fd181a180d5751101d37a50 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-16/+16
| | | | | | | | | | | | | | | | | Default values should have mark-up to denote that they are code. This commit changes: -"property is true" to "property is \c true". -"Returns true" to "Returns \c true". -"property is false" to "property is \c false". -"returns true" to "returns \c true". -"returns false" to "returns \c false". src/3rdparty and non-documentation instances were ignored. Task-number: QTBUG-33360 Change-Id: Ie87eaa57af947caa1230602b61c5c46292a4cf4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Repurpose the former Q_OS_MAC synonym "Q_OS_MACX" to mean "OS X".Jake Petroules2013-05-091-1/+1
| | | | | | | | | | | | | | The equivalent was done earlier for qmake, and this will enable developers writing OS X-specific code to use #ifdef Q_OS_MACX as opposed to overly verbose #if defined(Q_OS_MAC) && !defined(Q_OS_IOS). The sole usage of Q_OS_MACX within qtbase has been changed to the now appropriate value and documentation has been updated. Change-Id: I2c59eea02e94b691b705170b2f96a97940fdc756 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-01-221-1/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsavefile_p.h src/corelib/tools/qregularexpression.cpp src/gui/util/qvalidator.cpp src/gui/util/qvalidator.h Change-Id: I58fdf0358bd86e2fad5d9ad0556f3d3f1f535825
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | | | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Doc: Update the info on the QSharedPointer internalsThiago Macieira2013-01-151-31/+24
| | | | | | | | | | | | | | Some of it still referred to classes that were cleaned up in Qt 5.0 Change-Id: Ief4ed4b4fce074884f755b0d18a526ac40ad1b0b Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Fix the \since version for QSharedPointer::create().Stephen Kelly2013-01-071-1/+1
| | | | | | | | | | | | | | | | | | | | It is not relevant that it has been part of the class since Qt 4.6. It has always been internal until now. The release where it became public API (5.1) is what is relevant. Change-Id: Ib740f3ed6df190884a94fb2c11dd74cd7edb7b1a Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Add support for multiple arguments to QSharedPointer::create()Thiago Macieira2012-12-231-0/+31
|/ | | | | | | | Requires C++11 rvalue references and variadic templates so we can implement perfect forwarding. Change-Id: I62e47d1ffd0c61e8386f9f246aa79031b7430b46 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Optimise the deletion of a QSharedPointer with no custom deleterThiago Macieira2012-10-101-0/+7
| | | | | | | | | | | | | | | | When QSharedPointer is created with no user-specified custom deleter, instead of storing a pointer in ExternalRefCount::destroyer to a static function which, in turn, calls normalDeleter<T> indirectly (via another function pointer), specialise the CustomDeleter class and make it not store the pointer, but instead do the deleting directly. The benefits are: - the QSharedPointer's private data is smaller - there is no double-indirection via indirect jumps to the actual deleter Change-Id: Ice5653c144912efb1226e432267a047b9799aaca Reviewed-by: Olivier Goffart <ogoffart@woboq.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>
* Doc: Add \inmodule QtCore to all QtCore class doc bodiesThiago Macieira2012-08-231-0/+2
| | | | | Change-Id: I19100755c97cc155c76a859e19940e9f9222d34e Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Record if a metatype is a smart pointer to a QObject derived.Stephen Kelly2012-06-201-0/+2
| | | | | | | | | | | | This allows QVariant/QMetaType software (such as QtDeclarative) to deal with smart pointers in a similar way to how they can deal with naked pointers (accessing properties etc). This also adds a requirement that T be fully defined when QSharedPointer<T> is inserted into a QVariant. Change-Id: I29e12b8a6aa5f4aadbd62f92b89bc238f64b5725 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Add some internal API for extracting a QSharedPointer<T> from QVariant.Stephen Kelly2012-06-201-0/+20
| | | | | | | | | | | | | The T must be derived from QObject, or it will fail to compile. This will allow scripting or other 'wrapping' and runtime environments like QtDeclarative to handle QSharedPointers to types derived from QObject properly. A QSharedPointer<T> can be inserted into a QVariant, and where T derives from QObject, a QSharedPointer<QObject> can be extracted from the QVariant, and its properties are then accessible. Change-Id: I68d6d89aceceb019267bd7301baa2047f9c09b90 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge two internal classes of QSharedPointer and de-virtualise themThiago Macieira2012-06-121-83/+40
| | | | | | | | | | | | | | | | | | | | | The two classes are QtSharedPointer::ExternalRefCountData and ExternalRefCountWithDestroyFn. The split existed because of what Qt 4.5 did before custom deleters existed: the ExternalRefCountData class was a virtual class that contained a destroy() virtual, which was in charge of deleting the data or returning false if it didn't. Turns out that virtual classes was a mistake. This commit de-virtualises them -- we couldn't do it in Qt 4 because of binary compatibility. This saves us one pointer-size in the size of the private, plus the fact that fewer symbols are required (there is no virtual table to be initialised). Additionaly, since a deleter is always stored with the reference count, we don't need the split between the two classes anymore. Change-Id: I1cd9400561dcee089a406a57bd856b1730f18afc Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Deprecate the use of QWeakPointer to track QObjects.Stephen Kelly2012-06-071-48/+8
| | | | | | | | | | | | | | The main problem with using QWeakPointer to track QObjects is that it has API to convert to QSharedPointer, which is undefined behavior. There is no need to overload the meaning of QWeakPointer with QObject tracking. QPointer is more suitable and should be used instead. Because QPointer is implemented in terms of QWeakPointer, we need to add some overloads which are not deprecated. Change-Id: If0333e4800c9fd277629cc69185c9ca3e4e7e81d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSharedPointer: add reset() member functionsMarc Mutz2012-03-161-0/+29
| | | | | | | | | | These have been added for std::shared_ptr compatibility, but in particular to allow tst_qnetworkreply && friends to drop the implicit conversions added to QSP by inheritance, so QSP can become final. Change-Id: I0f0401b02125d65622e52393b40a3b10bd9a850c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSharedPointer: remove two emtpy functions.Debao Zhang2012-03-151-35/+2
| | | | | | | | | As the comments says:they are broken by design, and replaced with other functions. The purpose of their existence is for BIC with Qt4.5. Change-Id: I9453f816a7b7c6812499b89b7c60f0fd99dea27c Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make it possible to put QObject tracked with QWeakPointer inside QSharedPointerOlivier Goffart2012-02-101-15/+13
| | | | | | | | | | | | | | | | Do that by keeping the QWeakPointer that track QObject independent of the ones that track QSharedPointer. QSharedPointer do not touch the sharedRefCount in QObjectPrivate anymore When converting a QWeakPointer constructed from a QObject to a QSharedPointer, it will display a warning saying one should not do that. Task-number: QTBUG-22622 Change-Id: I3595e3e7401702410776c458687ab357ad9366ab Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.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>
* 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>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Replace implicit QAtomic* casts with explicit load()/store()Bradley T. Hughes2011-10-271-5/+6
| | | | | Change-Id: Ia7ef1a8e01001f203e409c710c977d6f4686342e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make all uses of QBasicAtomicInt and Pointer use load() and store()Thiago Macieira2011-10-031-3/+3
| | | | | | | | | | | | | | Most of these changes are search-and-replace of d->ref ==, d->ref != and d->ref =. The QBasicAtomicPointer in QObjectPrivate::Connection didn't need to be basic, so I made it QAtomicPointer. Change-Id: Ie3271abd1728af599f9ab17c6f4868e475f17bb6 Reviewed-on: http://codereview.qt-project.org/5030 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@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/+1501
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