summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject_p.h
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Reduce memory usage of dynamic propertiesSimon Hausmann2015-08-101-1/+1
| | | | | | | | | The dynamic property variants are stored as QList<QVariant>, which unfortunately results in QList to behave as array-list because of the size of QVariant. By storing the variants in a vector directly we can eliminate the array-list element pointers. Change-Id: I8736e1cf48b9fc97df3007df4a439b793933f346 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* De-duplicate vtables, part I: exported private classesMarc Mutz2015-06-031-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | By making the destructor (usually the first non-inline, non-pure, virtual function, and therefore the trigger for most compilers to emit the vtable and type_info structures for the class in that TU) out-of-line, vtables and, more importantly, type_info structures for the class are pinned to a single TU. This prevents false negative dynamic_cast and catch evaluation. In this first batch, we de-inline destructors of exported private classes. Since they are already exported, users of these classes are unaffected by the change, and since it's private API, we don't need to avoid adding code to the out-of-line destructor until Qt 6. Change-Id: I450707877d2cb6a77f79ae1dd355facb98d6c517 Reported-by: Volker Krause <volker.krause@kdab.com> Task-number: QTBUG-45582 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.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>
* Introduce helper for QML to allow creating QWidget hierarchiesSimon Hausmann2015-01-201-0/+1
| | | | | | | | | | Commit 1259c5768e410361bcd8b5cf0c2057a2ebabda83 in qtdeclarative removed the ability to create QWidgets in QML by giving them the correct parent, which requires calling QWidget::setParent instead of QObject::setParent. This patch introduces a hook that will allow QtQml to give widgets a proper parent. Change-Id: I84c57ca5032582c43e405219343d55ac9cf2ffa0 Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* Add Q_DECL_OVERRIDE in the src subdirectoryOlivier Goffart2014-12-031-2/+2
| | | | | | | | | | Done automatically with clang-modernize on linux (But does not add Q_DECL_OVERRIDE to the function that are marked as inline because it a compilation error with MSVC2010) Change-Id: I2196ee26e3e6fe20816834ecea5ea389eeab3171 Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* QObject: fix valgrind warning when disconnectingOlivier Goffart2014-08-091-1/+1
| | | | | | | | | | | | | | QObjectPrivate::Connection::method should never be called when the Connection was made with the function pointer syntax This caused valgrind warning about using uninitialized value on such code: QObject::connect(&o, &Object::aSignal, &o, &Object::aSlot); o.disconnect(&o, SLOT(aSlot())); Change-Id: Iaff9ecd3ddfe665db92726b420021493453c4cea Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix usage of QObjectPrivate::connect when q_func() is private.Olivier Goffart2014-01-291-2/+2
| | | | | | | | | | q_func() which is declared in Q_DECLARE_PUBLIC is usually private. We should use q_ptr directly in QObjectPrivate::connect, otherwise it does not compile when trying to access the private q_func Change-Id: I235165a0994327102dbb31c390c2cafdffe806dc Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-01-201-4/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.h src/corelib/tools/qstring.cpp src/gui/image/image.pri src/gui/image/qimage.cpp src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/eglfs/qeglfshooks_stub.cpp tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp Change-Id: I3b9ba029c8f2263b011f204fdf68c3231c6d4ce5
| * Do not consider a signal to be connected if only a signal spy is installed.Volker Krause2014-01-161-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This fixes QtQuick key handling not propagating key events beyond the specific onXPressed handlers, due to erroneously thinking those exist, when signal spy callbacks are present. Considering signal spies for isSignalConnected() goes back to 87239ef6 in Qt4, and seems to be there just due to this code being based on activate(), where this check obviously makes sense. Change-Id: Iad41e42a8d3ee2a16a55be7d1a7cdc51484981ce Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Optimize QObject::senderSignalIndex to only iterate the d->senders once.Milian Wolff2014-01-091-1/+0
|/ | | | | | | | | | | | | | | QObject::senderSignalIndex is, combined with ::sender(), the current hotspot in the QWebChannel which makes heavy use of it in its 1-to-many QSignalSpy implementation. This patch optimizes the senderSignalIndex by only iterating over the linked senders list once, instead of twice. I.e. it first iterated over it to find the signal index, then again to find the sender to convert to a method-offset. Change-Id: Ic86aed0dce891b87b953a6ec2364a81695bd4876 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Fix QtDeclarative and QtQml co-existence part three ;(v5.2.0Simon Hausmann2013-12-061-0/+8
| | | | | | | | | | | | | | | | | | Unfortunately the QObject destroyed callbacks for QtQml and QtDeclarative can't be called in sequence, because if the QQmlData has the ownsMemory bit set, then the destroyed callback will delete the QQmlData, and the sub-sequent call to the destroyed callback of qml1 will try to dereference the QQmlData's first bit (ownedByQml1), which is already destroyed. This patch fixes that by simply sharing the assumption of the first bit indicating module ownership (QtQml vs. QtDeclarative) also to qtbase and using it to distinguish between which destroyed callback function to call. Task-number: QTCREATORBUG-10273 Change-Id: I2773a31a3e9b3a1c22d1c1f33b2f29f3296cb3cf Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Allow for QtDeclarative and QtQml to co-exist at run-timeSimon Hausmann2013-11-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Qml has a bunch of hooks in QObject, that are callbacks as function pointers when things happen in QObject. QtDeclarative (Qml1) only needs one callback, for object destruction. In preparation for allowing both run-times to co-exist, this patch forks the callback, keeping the "default" variant for QtQml and having a *_qml1 variant for QtDeclarative. QtQml continues to set the callback variable for the default and QtDeclarative will set the _qml1 variant. It is however a limitation that a QObject instance can only be exposed to _one_ engine at a time, and it is not possible to make a transfer. Double exposure will result in crashes. This patch alone is not sufficient to fix the bug, the QQmlData/QDeclarativeData structures in Qml1 and Qml2 need to be extended to allow distinction at run-time. Task-number: QTBUG-35006 Change-Id: I3bac023873b5656a8a4f117fe816bafcda77b67d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-1/+1
| | | | | | | | | | | | | | | | | 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>
* Use Q_STATIC_ASSERT to report error about missing Q_OBJECTOlivier Goffart2013-09-141-2/+4
| | | | | | | | | | Q_STATIC_ASSERT gives better error with C++11 enabled. Aslo the qt_check_for_QOBJECT_macro had warning on some compiler since it used null reference Change-Id: Ic6115da800064b00c50a5762f0b79f5f656bf750 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add internal functions to QObjectPrivate for signal & slot connections in QMLSimon Hausmann2013-06-071-0/+7
| | | | | | | | | | | | | | | | | | In QML it is common to connect signals to slots that are implemented as JavaScript functions. QML used to maintain separate data structures that mirrored the QObject connection list and kept references to the JavaScript objects necessary to perform the call on signal activation. The recent addition of functor based QObject::connect makes it possible to store this information in QSlotObjectBase sub-class instead, which eliminates any extra bookkeeping. This patch adds internal connect and disconnect overloads to QObjectPrivate that allow for connecting QObject *sender, int signalIndex to a given QSlotObjectBase and similar for disconnect. Change-Id: I90f43d13eb95bd884d752484cf4faacc446f4d6a Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Add private API to connect to slots in QObjectPrivateOlivier Goffart2013-02-281-0/+77
| | | | | Change-Id: I16ffbf91ff4c6e9fca6fe7984800d2c24e70701b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Fix references to Qt TestSze Howe Koh2013-01-301-1/+1
| | | | | | | | | | | | | | | | QtTestLib and QTestLib don't exist. The proper name is "QtTest" (code) or "Qt Test" (English) http://qt-project.org/wiki/Spelling_Module_Names_in_Qt_Documentation http://lists.qt-project.org/pipermail/interest/2012-December/005221.html Files paths in qttestlib.qdocconf can't be changed easily however, as it breaks things. So, they're left as they are. Change-Id: Ifbc44ea858c453bedad8cd7723f847e67fc7a85a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.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>
* QSlotObjectBase: combat virtual function "bloat"Marc Mutz2012-08-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In C++, the compiler creates extra functions and data for classes with virtual functions. This can lead to "virtual function bloat": http://www.boost.org/doc/libs/1_47_0/doc/html/function/misc.html#id1382504 This is especially true when the number of instances is of the same order of magnitute as the number of derived classes, such as is common with type erasure techniques. One such case is the QSlotObjectBase hierarchy, which this patch tackles. The mechanics of this optimisation are simple: re-implement the virtual function call mechanism by hand, with function pointers. But we go one step further and collapse the vtable into a single pointer to a function that implements all three currently-defined operations, swtching on an 'int which' argument. This even allows us to extend this in a BC way, should that become necessary later, by adding a new Operation and using the void** argument to transport arguments, if any. This approach was inspired by: Ulrich Drepper: How To Write Shared Libraries, Section 2.4.4 http://www.akkadia.org/drepper/dsohowto.pdf Also move the QSlotObjectBase hierarchy out of QObject so as not to export all the derived classes. This was pointed out in review by Thiago. Results (Linux amd64, GCC 4.8-pre -O2 -std=c++11, stripped): size tst_qobject* text data bss dec hex filename 523275 21192 48 544515 84f03 tst_qobject (old) 507343 13984 48 521375 7f49f tst_qobject (new) relinfo.pl tst_qobject* (old) tst_qobject: 473 relocations, 0 relative (0%), 240 PLT entries, 240 for local syms (100%), 0 users (new) tst_qobject: 323 relocations, 0 relative (0%), 238 PLT entries, 238 for local syms (100%), 0 users Change-Id: I40ad4744dde8c5c29ef62ed2d82d4b1ede178510 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Provide access to (dis)connectNotify() from other objects.Thomas McGuire2012-07-241-0/+15
| | | | | | | | | This is the first step to fix (dis)connectNotify() not getting called for QML signal handlers and bindings. Change-Id: I5cfc126a5562a20031d3af8415c60d101603dd8d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Call QObject::disconnectNotify() when receiver is destroyedKent Hansen2012-06-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Store the signal index in QObjectPrivate::Connection, thereby making it available in "implicit" disconnect contexts (i.e., receiver deletion). This change does not cause the size of QObjectPrivate::Connection to grow (still 40 bytes on 32-bit Linux, 72 bytes on 64-bit Mac). Valgrinding the new benchmark indicates that the percentage of the time spent in the QObject destructor increased from 7.8% to 8.4% on ia32, for that particular stress test; the increase is the combined cost of calling metaObject(), QMetaObjectPrivate::signal(), and disconnectNotify() for one connection. In practice, the measured wallclock time increased by about 3ms for a 500ms run (which repeatedly constructs, connects, and destroys an object). Task-number: QTBUG-4844 Change-Id: I1beb01c753f31542fc0acb62edb4c6d165fcc5b4 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Add QAbstractDeclarativeData::isSignalConnected hookKent Hansen2012-06-261-0/+3
| | | | | | | | | | | | | | Similar to QAbstractDeclarative::receivers. This hook will allow QObject::isSignalConnected(QMetaMethod) to return true when there are QML-managed connections. It's important that the hook is called from QObjectPrivate::isSignalConnected(uint), since QML calls that function. Change-Id: I9c5e42f2b3e7f985af02905985a3a47101cdee05 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Change testlib signal dumper hooks to use signal index rangeKent Hansen2012-06-041-3/+3
| | | | | | | | | | | | Another step towards getting rid of the class method offset computation in QMetaObject::activate(). Since QMetaObjectPrivate::signal() is private API, this also required adding a testlib dependency on core-private (and getting rid of the duplicated QSignalSpyCallbackSet struct). Change-Id: I0d830f35392a6b44fc321c5285877ec0bf437100 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Change QConnectionSenderSwitcher et al to use signal index rangeKent Hansen2012-06-031-0/+3
| | | | | | | | | | | | | First step towards getting rid of the signal_absolute_index variable from QMetaObject::activate() (which requires computation of the class's method offset). This also required changing the implementation of the public function senderSignalIndex() so it still returns an index in the full method range. Change-Id: I58571eb3c8099ea5b673682872c53875f5ea8c13 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Move implementation of QObject::senderSignalIndex() to QObjectPrivateKent Hansen2012-06-011-0/+1
| | | | | | | | In preparation of changing the implementation to return an index in the signals-only range, not all-methods range. Change-Id: Ib743a4bc9da27ad776ade262b215ebf988e7ab28 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Move rarely used QObjectPrivate data to extraDataMartin Jones2012-05-211-4/+13
| | | | | | | | | | | Move runningTimers, eventFilters and objectName data members to ExtraData. Saves 12 bytes per QObject for 95% of use cases (QObjectPrivate goes from 76B -> 64B). Change-Id: I5648c89f65a7be3ea51bd703ee8a9dcff6222c3c Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Encapsulate the dynamic meta object pointerAaron Kennedy2012-05-181-3/+14
| | | | | | | | | This change allows us to delay creating the actual meta object until it is actually required. Change-Id: I1c4a4226bd82fa606b206dd60322f49b49c32463 Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove QAbstractDeclarativeData::objectNameChanged.Michael Brasser2012-05-101-1/+0
| | | | | | | | | | There is now an actual NOTIFY signal for this property, and the callback is no longer necessary. Change-Id: I664714e22e607c747f144250cfb78de8c1d28686 Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Add QMetaMethod-based QObject::connect/disconnectNotify() APIKent Hansen2012-05-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This API will fully replace the const char *-based connectNotify() and disconnectNotify() in Qt5; the old functions will be REMOVED before Qt 5.0 final. The new implementation fixes the long-standing issue of connectNotify() not being called when using the (internal) index-based QMetaObject::connect() (e.g., from QML). As with the old API, there are still two "unintuitive" behaviors concerning disconnectNotify(): - disconnectNotify() is not called when the signal is disconnected using the QObject::disconnect(QMetaObject::Connection) overload. - disconnectNotify() is not called when a receiver is destroyed (i.e., when a connection is implicitly removed). The old versions of connectNotify() and disconnectNotify() are kept for now, and they are still called. They will be removed once known existing reimplementations (e.g., QtNetwork, QtDBus) have been ported to the new API. Change-Id: I8b4f007f3c6d89199c1ba04a3e23c8ca314e0896 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Add a receivers callback to QAbstractDeclarativeData.Michael Brasser2012-04-201-0/+1
| | | | | Change-Id: I767fabd66c7de535db26e779855d21ec5b94e947 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Merge remote-tracking branch 'origin/api_changes'Lars Knoll2012-03-041-10/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: dist/changes-5.0.0 mkspecs/features/qt_module_config.prf qmake/project.cpp qmake/property.cpp Change-Id: I6e4af40743a9aeff8ed18533a48036e332acc296
| * Make qobject_p.h not need qvariant.h.Stephen Kelly2012-02-291-10/+1
| | | | | | | | | | | | | | | | | | | | Move definition of ExtraData to the implementation file. As a side effect, we need to include qhash.h in some other places. Change-Id: I8bb4ec0940ae51c7d6961c9a51adb80fd444e1e3 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | QBoolBlocker: make constructor explicit and disable copyingMarc Mutz2012-03-011-1/+2
|/ | | | | Change-Id: If294eff3f84f837ed554c572527d46a89660de9c Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* Don't release timer ids in event dispatcher codeBradley T. Hughes2012-01-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3rdparty event dispatchers are impossible to write without using the internal API QAbstractEventDispatcherPrivate::releaseTimerId(). Fix this by having each QObject keep track of its own timer ids, and release them when they are no longer used. As a side effect, this makes the QObjectData::pendTimer bit unnecessary. This also removes the QObjectData::inThreadChangeEvent hack that the event dispatchers used to avoid releasing timer ids when moving timers to a new thread. QBasicTimer becomes even more low-level. It cannot use QObject::startTimer() anymore, since we do not have a way to call QObject::killTimer() from QBasicTimer::stop(). QBasicTimer uses the QAbstractEventDispatcher interface directly, and releases the timer id explicitly as well when stopping the timer. This change also fixes some rare timer id "leaks" when destroying or stopping timers after a thread has exited and destroyed its event dispatcher (the timer ids would never be released when no dispatcher exists). Globally destructed QObjects that have running timers may try to release their timer ids after the timer id freelist has been destroyed. This commit accomodates such objects by avoiding the null dereference in QAbstractEventDispatcherPrivate::releaseTimerId(). Change-Id: I2d7cd8221fae441f3cf02b6c0b4bc16063834d00 Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Remove QT_JAMBI_BUILD codeBradley T. Hughes2011-12-151-7/+0
| | | | | Change-Id: Ic9231b11293af4352f11cf075893175f0c9a471f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove QMetaObject guards and deprecate QPointer.Bradley T. Hughes2011-12-101-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QWeakPointer is superior and preferred. Remove QMetaObject::addGuard(), QMetaObject::changeGuard(), QMetaObject::removeGuard(), and QObjectPrivate::clearGuards(). Implement QPointer using QWeakPointer<T> instead. This changes the behavior of QPointer in 2 ways: - During destruction of a QWidget. Previously, the destructor of QWidget would reset all QPointers so that they would return zero when destroying children. Update tst_QPointer to account for this change. - When constructing a QSharedPointer to take ownership of an object after a QPointer is already tracking the object. Previously, the shared pointer construction would not be affected by the QPointer, but now that QPointer is implemented using QWeakPoiner, constructing the QSharedPointer will cause an abort(). Fix tst_QSharedPointer by removing the use of QPointer in the objectCast() test. These behavior changes are documented in the QPointer class documentation and in the changes file. Change-Id: I92d0276219c076ece7bcb60f6e1b9120ce4f5747 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Add support for QueuedConnection when connecting using the new syntaxOlivier Goffart2011-11-251-0/+4
| | | | | | | QMetaCallEvent now can handle a pointer to QSlotObjectBase Change-Id: I94da1e68ce9bb1fd96a9ae013a389552eb625faa Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* New QObject connection syntaxOlivier Goffart2011-11-251-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In addition to the old connection syntax, you can now connect using function pointers. connect(sender, &Sender::valueChanged, receiver, &Receiver::updateValue ); You can connect also to functor or C++11 lambdas The connections are now type safe (no more problems with namespaces or typedefs). Implicit type conversion is also supported. The new syntax forces us to change the meaning of signal form protected to public, in order to be able to access the signal's address everywhere The way it works is by introducing new overload of QObject::connect that take function pointer as parametter. Those new overload are template function, that are implemented inline. The actual implementation is in QObject::connectImpl which take a QObject::QSlotObject* as parametter for the slot. That slot object contains a virtual function which call the slot which has to be implemented in the header as it depends on the template parametter. So the internals of QObjectPrivate::Connection will store this QObjectSlot* in order to be able to make the call. You can read a full description here: http://developer.qt.nokia.com/wiki/New_Signal_Slot_Syntax History of commits before it was imported on gerrit: https://qt.gitorious.org/~ogoffart/qt/ogoffarts-qtbase/commits/qobject_connect_ptr Thread on the mailing list: http://lists.qt.nokia.com/pipermail/qt5-feedback/2011-August/000796.html http://lists.qt.nokia.com/pipermail/qt5-feedback/2011-September/001248.html (The discussions on the mailing list were about trying to find a solution that do not need making signals public, but no user friendly solution was found) Note: support for QueuedConnection, and the symetric QObject::disconnect is added in another commit. Qt::UniqueConnection is not supported yet in the new overload. Change-Id: I67d08436b0720e7f2992be9f7e34770960fa58fa Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change the return value of QObject::connectOlivier Goffart2011-11-251-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | From a bool to a handle to to connection. Also added a new overload of disconnect that disconnect a handle This is required because with the new syntax taking lambda or functors, it is the only way to disconnect a connection (as it is impossible to compare functors) The new return value is QMetaObject::Connection, it is a wrapper around the internal QObjectPrivate::Connection. QObjectPrivate::Connection is now reference counted. tst_qglobal.cpp: This test set up an internal callback, and the callback do not set any proper connection handle (and tbh, it would be hard for it to do so). So the returned QMetaObject::Connection is invalid, and ok is false (Internal callbacks are only used for jambi and should probably be removed) Change-Id: I111626fb4f47efc4db5e2ea5bff9da15f08fea7b Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make all uses of QBasicAtomicInt and Pointer use load() and store()Thiago Macieira2011-10-031-1/+1
| | | | | | | | | | | | | | 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>
* Add a signal emitted callback to QAbstractDeclarativeDataAaron Kennedy2011-08-301-0/+1
| | | | | | | | | | | For property notify signals, QtDeclarative can manage connections in a more special case - and more performant - way. This patch adds a callback hook so that QtDeclarative can intercept signals being emitted by declarative objects. Change-Id: I72554e80df0a4257da65d81cc1c5db88a11446a4 Reviewed-on: http://codereview.qt.nokia.com/3363 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Remove Qt3 support functionality from parts of QtCoreLars Knoll2011-06-291-12/+0
| | | | | | | Change-Id: I90f391e9bfc412087bd0401e28d2497571f81aa1 Reviewed-on: http://codereview.qt.nokia.com/825 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Liang Qi <liang.qi@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/+305
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