summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qrefcount.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-05-191-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp src/network/access/qnetworkaccessmanager.cpp src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h src/widgets/widgets/qlineedit_p.cpp src/widgets/widgets/qlineedit_p.h src/winmain/winmain.pro tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp tools/configure/configureapp.cpp Change-Id: Ib9997b0d0f91946e4081d36c0c6b696c5c983b2a
| * Fix Clang -Wexpansion-to-defined warning by deprecating QT_SUPPORTSThiago Macieira2016-05-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The C and C++ standards say it's undefined whether the preprocessor supports macros that expand to defined() will operate as an ifdef. Clang 3.9 started complaining about that fact. One solution was to change QT_SUPPORTS to check for zero or one, which means we need to change the #defines QT_NO_xxx to #define QT_NO_xxx 1. The C standard says we don't need to #define to 0, as an unknown token is interpreted as zero. However, that might produce a warning (GCC with -Wundef), so changing the macro this way is not recommended. Instead, we deprecate the macro and replace the uses with #ifdef/ndef. Change-Id: Id75834dab9ed466e94c7ffff1444874d5680b96a Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* 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>
* Deprecate setSharable in Qt containersThiago Macieira2014-04-241-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | The ability to set a container to be unsharable has very little use and it costs us an extra conditional for every refcount up and possibly down. This change is a no-op for current Qt 5. It shuffles a few things around just so Qt can compile if you define QT_NO_UNSHARABLE_CONTAINERS. That is done to ease the fixing of the code in Qt 6 and to make my life easier: I'll keep that defined in my local Qt build so I can catch any misuses of this deprecated API. The newly deprecated methods are not marked QT_DEPRECATED because the bootstrapped tools wouldn't build -- they're built with QT_NO_DEPRECATED defined, which causes build errors. [ChangeLog][QtCore] The setSharable() and isSharable() functions in Qt containers has been deprecated and will be removed in Qt 6. New applications should not use this feature, while old applications that may be using this (undocumented) feature should port away from it. Discussed-on: http://lists.qt-project.org/pipermail/development/2014-February/015724.html Change-Id: I789771743dcaed6a43eccd99382f8b3ffa61e479 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-291-4/+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>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@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>
* Add Q_DECL_NOTHROW to QRefCount.Thiago Macieira2012-08-091-8/+8
| | | | | | | | | For the same reason as the previous commit (about the atomic classes), mark these functions as never throwing an exception. Change-Id: Idf46e41b226f54cb8658416efdf985ca40dd2952 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Merge remote-tracking branch 'gerrit/master' into containersJoão Abecasis2012-02-051-3/+2
|\ | | | | | | | | | | | | Conflicts: src/corelib/tools/qstring.cpp Change-Id: I23d214bf33c2badfae1876da3cc7d6d8f6e635fb
| * 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>
* | Removed remaining int operations from RefCountJoão Abecasis2012-01-241-9/+0
| | | | | | | | | | | | | | | | | | | | | | RefCount has currently three magic values (-1 for statics, 0 for unsharables, 1 for unshared-sharable). From the API point of view, the individual values are not important or necessary and it's error prone for users of the class to be fiddling with them. Change-Id: I7037cc31d3d062abbad73d04962bc74d85ebd20f Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Merge remote-tracking branch 'gerrit/master' into containersJoão Abecasis2012-01-161-1/+1
|\| | | | | | | Change-Id: I2d358b912f1055ee6021d13de2f66fd459aaa355
| * Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | | | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* | Add setSharable support in QArrayData stackJoão Abecasis2012-01-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Making use of the same feature added in RefCount. To keep with the intention of avoiding the allocation of "empty" array headers, this introduces an unsharable_empty, which allows users to maintain the "unsharable bit" on empty containers, without imposing any actual allocations. (Before anyone asks, there is no point to a zero-sized capacity-reserved container so no other combinations are needed for now.) Change-Id: Icaa40ac3100ad954fdc20dee0c991861136a5b19 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* | Add support for setSharable in RefCountJoão Abecasis2012-01-051-3/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A reference count of 0 (zero) would never change. RefCount::deref to zero would return false (resource should be freed), subsequent calls on the same state would return true and not change state. While safe from RefCount's side, calling deref on a reference count of zero potentially indicated a dangling reference. With this change, a reference count of 0 is now abused to imply a non-sharable instance (cf. QVector::setSharable). This instance is to be deleted upon deref(), as the data is not shared and has a single owner. In practice, this means an (intentional) change in behaviour in that deref'ing zero still won't change state, but will return false, turning previous access to dangling references into double free errors. Users of RefCount wanting to support non-sharable instances are required to check the return of RefCount::ref() and use RefCount::isShared() to determine whether to detach (instead of directly checking count == 1). New functions are introduced to determine whether RefCount indicates a "Static" (permanent, typically read-only) or "Sharable" instance and whether the instance is currently "Shared" and requires detaching prior to accepting modifications.. This change formalizes -1 as the value used to flag persistent, read-only instances, no longer reserving the full negative domain. The concrete value is part of the ABI, but not of the API. (isStatic and Q_REFCOUNT_INITIALIZE_STATIC are part of the API, instead) Change-Id: I9a63c844155319bef0411e02b47f9d92476afefe Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* | Retire the generic Q_REFCOUNT_INITIALIZER macroJoão Abecasis2012-01-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This was only being used to initialize static read-only RefCount instances, where the value is hard-wired to -1. Instead of allowing initialization with arbitrary values (which for a reference count can be error prone) the intent of the macro is made explicit with its replacement Q_REFCOUNT_INITIALIZE_STATIC. Change-Id: I5b0f3f1eb58c3d010e49e9259ff4d06cbab2fd35 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | Get rid of assignment operators in RefCountJoão Abecasis2012-01-041-4/+2
|/ | | | | | | | | | | | , and make it strictly a POD struct. Since this operator was only being used to set the initial (owned) value of the reference count, the name of the function introduced here to replace it makes that use case explicit. Change-Id: I2feadd2ac35dcb75ca211471baf5044a5f57cd62 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make all uses of QBasicAtomicInt and Pointer use load() and store()Thiago Macieira2011-10-031-8/+10
| | | | | | | | | | | | | | 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>
* "Fix" the crash at startup on MSVCOlivier Goffart2011-07-151-2/+2
| | | | | | | | | | | | | | | | | | | | | The problem is that for some reasons, QByteArray::shared_null (and probably shared_empty, and the ones for QString) are not in the .rodata anymore, and they are initialized by code. programs like QMake, which has others global objects (like global QFiles) that uses QByteArray crashes, because they reference and dereference shared_null (and try to destroy shared_null) That happens before shared_null's refcount is initialized to -1 The solution here is not to ref() the objects that have a refcount of 0 (that is what the refcount is before it is initialized to -1) The real fix to this problem would be to understand why it is not in the proper section, and make sure it is. Change-Id: I5b7e966ed4c460b90dba70855f4dc50685dff97f Reviewed-on: http://codereview.qt.nokia.com/1712 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Add an internal QRefCount class to QtCoreLars Knoll2011-07-071-0/+92
The class will be used by QString and possibly other container classes to allow for the Data objects to be created at compile time in read-only memory. Change-Id: I9c7538bc97df637cc920e6e5ef23d67a93abac0d Reviewed-on: http://codereview.qt.nokia.com/1216 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>