summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* QComboBox: simplify codeGiuseppe D'Angelo2015-01-161-7/+6
| | | | | | | | Remove an useless check and hoist a costly call out of a loop. Change-Id: Ibd1750026af44462a4f0223a9b2f422ebcc7c0e3 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
* qtest_widgets.h: add support for pretty-printing QSizePolicyMarc Mutz2015-01-162-0/+101
| | | | | | | | | | | | | | | ... in QCOMPAREs. The implementation is hidden in a nested Internal namespace that retrieves the strings without strdup()ing. That makes it easier to compose these functions as there is no need to delete character arrays when using them. The public interface (which qstrdup()s) is implemented on top of these. [ChangeLog][QtTest] QCOMPARE now pretty-prints QSizePolicy{,::Policy,::ControlType{,s}}. Change-Id: Ib03d969847e5a12474c71a7921366b400025f680 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVariant: attempt to work around an ICE on linux-arm-gnueabi-g++ (Ubuntu ↵Marc Mutz2015-01-161-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 11.10) with constexpr QSizePolicy This is the error: src/corelib/kernel/qvariant_p.h: In constructor ‘QVariantPrivateSharedEx<T>::QVariantPrivateSharedEx() [with T = QSizePolicy]’: src/corelib/kernel/qvariant_p.h:107:61: internal compiler error: in gimplify_init_ctor_eval, at gimplify.c:3560 There are two things fishy in this file: 1. Use of the unnamed namespace in a file that gets included in different libraries. While not technically undefined behavior, it may become so when used in the implementation, which it is. 2. Missing explicit initialization of a member of QVariantPrivateSharedEx. This is just a wild guess, because the ICE happens in that line. That class itself is quite smelly, because the address of an object is taken before the lifetime of the object begins. A fix would be to store the object in a wrapper class from which QVPSEx inherits _first_, but then a cast from QVPSEx to QVariant::PrivateShared would require pointer adjustments, and I didn't look through all the code to determine whether that would be an issue. Having been bitten by this sometime ago: https://marcmutz.wordpress.com/private-practice/private-practice-taming-templates/#edit-20111128 I opted to do these easy changes first to see whether they already fix the ICE. Change-Id: Ic15fd928b3dff2318c425c915b2dab5e54254d71 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't call static members with objectThiago Macieira2015-01-161-3/+3
| | | | | | | This makes it clear that we're not modifying d. Change-Id: Ic5d393bfd36e48a193fcffff13b968c6d08e69f6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add QTimeZone::{systemTimeZone,utc}Thiago Macieira2015-01-163-5/+28
| | | | | | | | | [ChangeLog][QtCore][QTimeZone] Added methods systemTimeZone() and utc() that return QTimeZone objects for the system time zone and for UTC, respectively. Change-Id: Ic5d393bfd36e48a193fcffff13b96821bb8514b9 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix forkfd build when O_CLOEXEC isn't defined.Thiago Macieira2015-01-162-3/+3
| | | | | | | | | | | | | | | | | | O_CLOEXEC was introduced with the 2008 revision of POSIX.1 and it's the only way of doing child processes safely with fork(2) in multithreaded applications. But we need to support pre-2008 systems, so we can't use that constant. So let's just choose two arbitrary values for both of our constants -- we need to change both because we need to be sure that FFD_CLOEXEC won't be the same as FFD_NONBLOCK. Linux will probably implement them to the O_ constants, like epoll, signalfd and inotify have done. Change-Id: I20a5aa6e6264e7a219e19759eeb8747e01df05ff Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
* Fix assignment within a Q_ASSERTHolger Hans Peter Freyther2015-01-161-1/+1
| | | | | | | | | This was introduced in 3b844c16e0988b017c67b2329cbe34d4da112b33 and doesn't seem to be right. Change-Id: I1c6a9445996650566d44f223651dd0c855619a88 Fixes: Coverity CID 21589 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update QFileSelector to use QSysInfo betterThiago Macieira2015-01-161-21/+14
| | | | | | | | | | This reduces a bit of string duplication by relying on the constants defined in qglobal.cpp and detection via uname(2), in addition to adding the Linux distribution name as a selector. Change-Id: I64a46a0fc552c399db787125b1b32aae5c50056f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* eglfs: Split kms integration into multiple filesLaszlo Agocs2015-01-159-901/+1245
| | | | | | | | | | | Now that it's a plugin, the restrictions for the compiled-in hooks do not apply. Make it maintainable and prepare for future development by splitting up properly. The actual functions are not touched at all in this patch. Change-Id: I4c666817afe15b31a63c1f9fc01413e9a2376a3b Reviewed-by: Louai Al-Khanji <louai.al-khanji@theqtcompany.com>
* eglfs: Fix hardware cursor with kmsLaszlo Agocs2015-01-151-1/+5
| | | | | | | | | We have to set a default arrow cursor on startup because non-widget apps will not request one. This is how we behave with non-kms backends too. Change-Id: I11b7bf96e46f570bc49f3e8701616b13c480fda6 Reviewed-by: Louai Al-Khanji <louai.al-khanji@theqtcompany.com>
* Do not build kms platform plugin by defaultLaszlo Agocs2015-01-151-4/+0
| | | | | | | This plugin is deprecated and replaced by eglfs. Change-Id: Ib559ed411b145b2cb992cc475772894ecd936c07 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Avoid warning about QString from char in xcbLaszlo Agocs2015-01-151-1/+1
| | | | | Change-Id: I013f0caa8aba7fef07c7dbe90ed01dfb85347223 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Haiku: Make network module compile on HaikuTobias Koenig2015-01-141-0/+5
| | | | | | | | | Add the missing definition for IFF_RUNNING like documented on http://ports.haiku-files.org/wiki/CommonProblems Change-Id: Iea3fa224dc8e7e1e36674026efbb28289d2efa2a Reviewed-by: Augustin Cavalier <waddlesplash@gmail.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Reduce excessive painting caused by transient scrollbarsJ-P Nurmi2015-01-141-1/+1
| | | | | | | | | | | | The step logic in scrollByDelta() made scrollbar position to go temporarily outside its min/max boundaries, and then setValue() corrected it immediately back within its bounds. The false change notifications caused by this position vs. value ping pong caused plenty of unnecessary updates. Task-number: QTBUG-30316 Change-Id: I32dd5bdb7b0c578dfc5dfa1deecceb19bb98a2b3 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
* QComboBox: make setModel reset the root model indexGiuseppe D'Angelo2015-01-131-0/+4
| | | | | | | | | | | | | When changing models it makes no sense to keep the old root model index, pointing into a possibly deleted model. Reset it to the root of the new model is the best line of action. [ChangeLog][QtWidgets][QComboBox] QComboBox will now reset its root model index when a new model is set on it. Task-number: QTBUG-43350 Change-Id: I113d558ce19fcaed31f13abfbedc7a24302e28d7 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
* Introduce Q_ENUM and Q_FLAG macrosOlivier Goffart2015-01-135-2/+14
| | | | | | | | | | | | | | In replacement for Q_ENUMS and Q_FLAGS. Q_ENUM(Foo) has to be put after the declaration of Foo in an object. It will tell moc to include the enum in the meta object (just like Q_ENUMS) and will allow templated code to get the metaobject for that enum. Will be used by QDebug and QMetaType Change-Id: Iefaf8ae07dc0359828102bf384809346629b3e23 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* Add QWheelEvent::sourceShawn Rutledge2015-01-1310-19/+83
| | | | | | | | | | | | This is analogous to 0a92295ca829a62125c9f122fd3daec991993855 which added QMouseEvent::source. For now, we say that a wheel event is synthetic when it comes from a trackpad or other device that provides scrolling by some means other than an actual wheel. Change-Id: I0452ca2080b551b18b9c2f6e42db925d14ae339e Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Make QStyleHints usable in QMLJ-P Nurmi2015-01-132-18/+69
| | | | | | | Change-Id: Ia8f143d12c754b4af4a29bb9542cd050b5ae2ab0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Liang Qi <liang.qi@theqtcompany.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Extend selections in QGraphicsView when selection extension key downAndy Maloney2015-01-136-7/+70
| | | | | | | | | | | | | | If the user has some objects selected and holds down the "extend selection" key (Control on Windows, Command on Mac OS X), clicking and dragging a rubber band selection deselects the current selection. This is counter-intuitive and confusing for users. This commit fixes the behavior so users can extend selections using the rubber band when the proper key is held down. Task-number: QTBUG-6523 Change-Id: Ieda4aaa50adb351c0405f5cb8aae23332eec58a9 Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
* ANGLE: Disable MSVC warning 4996 for debug buildsKai Koehne2015-01-131-1/+2
| | | | | | | | | | | | | | | | | Disable compiler warning 4996 about the use of C++ standard library functions like std::copy: 'std::copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' Commit 0a76b6bc already silenced the warning in the general MSVC mkspecs, the flags set there are however overwritten for ANGLE. Change-Id: I8f9a84d19171057715a8f9be1e8338e02a6c5ba0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Avoid double cache lookup in QHostInfoCacheJędrzej Nowacki2015-01-131-2/+1
| | | | | Change-Id: If5ef2d2f117fe8c1abdf361f1122e32075e14385 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Support QMetaType::equals()Alex Blasche2015-01-133-4/+62
| | | | | | | | This avoids having to define operator< for types where operator== is required but operator< doesn't make any sense (e.g. QGeoCoordinate). Change-Id: I81f6a9d8fc0009a4514c974b5e02b446c50d1e31 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* QNX: Enable QSharedMemory and QSystemSemaphore support.Rafael Roquetto2015-01-131-7/+0
| | | | | | | | | Commit 96995db4af6e1f5e9fe313 implements the necessary bits for this to work under QNX. Change-Id: Ie9e2f421f4f27fcaf40697dd363e9ed047754f0d Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* moc: Don't link to inexistent parent staticMetaObjectGabriel de Dietrich2015-01-132-1/+7
| | | | | | | | | | | | | Contrarily to Q_OBJECTs, Q_GADGETs are not guaranteed to descend from a Q_GADGET. Here, we ensure that if the first superclass is a Q_GADGET, then the derived class will be treated as one. This allows gaps in the Q_GADGET hierarchy while preventing from trying to link to the inexistent staticMetaObject if there's no such ancestor. Change-Id: If10fb952e23655102a425bb18fe8babaf447a47f Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* qdoc: qdoc's 'square bracket' parameters were evaluated too earlyMartin Smith2015-01-127-28/+72
| | | | | | | | | | | | | | qdoc's link command (\l) allows an optional first argument enclosed in square brackets. This argument is used for narrowing and focusing the search for the link target. The argument should not be evaluated until the generate phase, but it was being evaluated in the prepare phase. This was also a problem when running qdoc in the single-exec mode. This update prevents qdoc from evaluating the argument until it is used in the generate phase. Change-Id: I82785e97077053fb5f5c11f0592155675334aaeb Task-number: QTBUG-42880 Reviewed-by: Martin Smith <martin.smith@digia.com>
* Add D-Bus types marshalling for Linux tray icon supportMarco Martin2015-01-122-0/+244
| | | | | | | | | | | | Add marshalling for icon pixmaps to be used in DBus tray icon support according to the specification http://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/Icons/ Task-number: QTBUG-31762 Change-Id: I16e66c272eef413a7c94345c273e5fd3a8c0f771 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Albert Astals Cid <albert.astals@canonical.com> Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* QFileSystemEntry: Replace manual seek in string with lastIndexOf()Orgad Shaneh2015-01-111-7/+1
| | | | | Change-Id: Icf45795a962baa7102c02293cb7ce1781b8f2f56 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove Q_STATIC_GLOBALxxx_OPERATOR macrosThiago Macieira2015-01-117-26/+18
| | | | | | | | | | These macros existed for working around an RVCT compiler bug, but since we stopped trying to work around it, the macros are no longer necessary. Change-Id: I76cc88d863b41f74f60cd9975dcc1959778c2740 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Do the same for qDebug of QByteArray and QLatin1StringThiago Macieira2015-01-112-3/+51
| | | | | | | | | | | | | | | QLatin1String are actually Unicode, so print them with \uXXXX sequences. QByteArray are binary (arbitrary), so print as hex. Since hex escape sequences in C are not limited in length (\x00000F is a valid hex sequence), we need to insert "" if the next character is a valid hex digit. [ChangeLog][QtCore][QDebug] Similarly, printing of QByteArrays whenever "noquote" is not active now prints the arrays in a format consumable in C++, with all non-printable characters printed in hex escape sequences. Change-Id: Ibd0c1a97cbac98610c65c1091bfbcf5581c835db Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* QDebug: pretty-print QStrings and QStringRefsThiago Macieira2015-01-115-4/+111
| | | | | | | | | | | | | [ChangeLog][QtCore][QDebug] Printing of QStrings and QStringRefs whenever "noquote" is not active now prints the strings in a format that can be copied back to C++ code. All characters that aren't printable in US-ASCII are escaped (this includes printable Unicode characters outside of US-ASCII). Pretty-printing will not respect QTextFormat padding or field widths. Change-Id: I169a8a0508e24693f5652f0129defe7f709e5d08 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Support threaded OpenGL on linux again.Gunnar Sletta2015-01-102-0/+9
| | | | | | | Broken since 8758f532ae6209bcf9447e27edc4fd412c0f173d. Change-Id: Ifadf37252cc7c1ca68b0a82320b12833f97bf302 Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* Haiku: Make corelib compile on HaikuTobias Koenig2015-01-105-2/+13
| | | | | Change-Id: I66bc492390eedd723ab7866d3c7a38539d708727 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Android: Don't assume native window decoration in QDockWidgetKai Pastor2015-01-101-1/+1
| | | | | | | | | | | Android does not decorate a floating QDockWidget, leaving the user with no option to close or move such a widget. This changes activates Qt's own drawing of window decorations for this case (similar to Win CE). [ChangeLog][Android][QtWidgets] Enable QDockWidget window decorations. Change-Id: Id46a994a8be9b8f3e7b530af118315cd36b5fb0e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* QWindowsVistaStyle: Draw PE_PanelItemViewItem for non-item view widgets.Friedemann Kleint2015-01-101-9/+10
| | | | | | Task-number: QTBUG-43157 Change-Id: I2a5f721cadc0dfffbb81902ef1d06ba34a729300 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* QHash: clean up class definitionMarc Mutz2015-01-102-26/+26
| | | | | | | ...by removing redundant '<Key, T>' and 'inline'. Change-Id: I9d81950c6384927633de07de511712f7274a1283 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtCore: mark some operations nothrowMarc Mutz2015-01-1019-68/+72
| | | | | | | | | | | | This shotgun-surgery approach is motivated by trying to get a clean(er) build for -Wnoexcept on GCC, so it is expected that for any class touched here, there will be more operations that can be marked nothrow. But they don't show up in conditional noexcept clauses, yet, so they are deferred to some later commit. Change-Id: I0eb10d75a26c361fb22cf785399e83b434bdf233 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QPen: mark copy/move/swap as nothrowMarc Mutz2015-01-102-7/+7
| | | | | Change-Id: Ib13d60256d96253934e0627d4c3015248e002e3f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove qSwap specialization from Q_DECLARE_SHAREDMarc Mutz2015-01-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | The way swapping is supposed to work is: 1. Each type supplies a swap() function or function template in its namespace. Any good STL implementation will find it there through ADL. As will the primary qSwap() template. 2. Each use of swap() in Qt, in particular in template code, should use qSwap() instead of std::swap() or the using+swap-trick, because qSwap() automatically enables ADL. It also has a sophisticated conditional noexcept specification that can be used in the custom swap() functions' own noexcept clause. This change also allows us to convert implicitly-shared classes' member-swap functions to noexcept one at a time, because the specialization will no longer be in conflict with the primary template regarding exception specifications. The primary's specification could, of course, be reused here, but it's complex and if the machinery around it is changed later on, it will not affect Q_DECLARE_SHARED classes. Change-Id: I3389a655a9fd8de370f363c8fcef60269a9f506c Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUnicodeTables: mark all functions as nothrowMarc Mutz2015-01-102-18/+18
| | | | | | | | | | | | Yes, this is necessary. The noexcept operator looks for noexcept tagging, not at the contents of the function to determine whether to return true. The more conditionally-noexcept functions are used, the more important it becomes that low-level functions are correctly marked noexcept. In that, it is like constexpr. Change-Id: I4bca178444d1fd7caf3a92f996b1536eebdb5014 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QModelIndex: plaster API with Q_DECL_NOTHROWMarc Mutz2015-01-101-13/+13
| | | | | | | | | | | | | | | | This is mostly straight-forward, but some things are worth noting: 1. Yes, this is necessary. The noexcept operator looks for noexcept tagging, not at the contents of the function to determine whether to return true. The more conditionally-noexcept functions are used, the more important it becomes that low-level classes are correctly marked noexcept. In that, it is like constexpr. 2. The functions that actually call into the model (data(), flags(), sibling(), ...) can throw (bad_alloc, if nothing else). Consequently, they're not marked nothrow. They're the only ones. Change-Id: Id0413212b0f1c049a339480ee449a53c3ca9fea0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRingBuffer: retrieve pointer to data more carefullyAlex Trotsenko2015-01-091-1/+1
| | | | | | | | | | | An empty ring buffer always has a pre-cached byte array in its container. In this case size() indicates that no data is available, but readPointer() tries to resolve this byte array. To avoid an illegal pointer as a result, return Q_NULLPTR instead. Change-Id: Icc5f08f071a8f02a14c112b6e1adbe5373bd9466 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* eglfs: Update screen destruction to follow the new approachLaszlo Agocs2015-01-093-2/+13
| | | | | | | | Call destroyScreen(), like other platform plugins do since 9b4fbe85d2e00c625c3d4abd975faf555000f685. Change-Id: Idbddb026d7a964f15c00acfacf70064405dc3f16 Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
* moc: Work around 'unused variable' MSVC warningKai Koehne2015-01-091-1/+2
| | | | | | | | | | | | MSVC prints warnings if all slots are actually static methods: moc_xxx.cpp:71: warning: C4189: '_t' : local variable is initialized but not referenced This can be easily avoided by using Q_UNUSED. Change-Id: Ice134a8a8d3e6aef1df1e7a89e9a2867281580fd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Get rid of QT_NO_QWARNING_MACROKai Koehne2015-01-092-3/+2
| | | | | | | Just use QT_NO_QDEBUG_MACRO, like we do already for qInfo. Change-Id: I4b2ef68427fbe6f253fe02a3ab161fa25186e834 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QtInfoMsgKai Koehne2015-01-0914-44/+345
| | | | | | | | | | | | | | Add an 'info' message type that can be used for messages that are neither warnings (QtWarningMsg), nor for debugging only (QtDebugMsg). This is useful mainly for applications that do not have to adhere to the 'do not print anything by default' paradigm that we have for the Qt libraries itself. [ChangeLog][QtCore][Logging] QtInfoMsg got added as a new QtMsgType. Use the new qInfo(), qCInfo() macros to log to it. Change-Id: I810995d63de46c41a9a99a34d37c0d417fa87a05 Reviewed-by: Jason McDonald <macadder1@gmail.com>
* QStandardPaths: add AppConfigLocation.David Faure2015-01-099-12/+52
| | | | | | | | | | | | | | | | | | | ConfigLocation was erroneously inconsistent, by adding the org name and app name on Windows (unintentionally) and not on Unix (while having subdirs in ~/.config is actually common practice for some XDG desktops) Therefore this adds AppConfigLocation, which always has the org name and app name (while GenericConfigLocation never does). [ChangeLog][QtCore][QStandardPaths] Added QStandardPaths::AppConfigLocation, for application-specific configuration directory. ConfigLocation was inconsistent. Task-number: QTBUG-38872 Task-number: QTBUG-38845 Change-Id: I80fb98f296436261f3996c9df87571c29b06ab35 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QStateMachine: replace a QHash key involving a QPointerMarc Mutz2015-01-092-4/+22
| | | | | | | | | | | | | | | | Using QPointers (or any type that makes a QPointer part of its identity) as a key in any associative container is wrong. They get externally set to nullptr, violating the associative container's class invariants, which could lead to data corruption, even though bucket-based hash implementations are less susceptible than binary trees. To fix, write a new class that acts much like the old QPair<QPointer<>,QByteArray>, but uses the QPointer only as a guard, not as part of its identity. To preseve identity, also saves the naked pointer originally passed and uses that for op== and qHash(). Change-Id: I4fa5a6bf86bad8fe7f5abe53d7c7f3ad3754d8d6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QStateMachine: fix some misleading codeMarc Mutz2015-01-091-3/+2
| | | | | | | | | | | | | | | | | | The old code creates a RestorableId from the passed (QObject*, QByteArray) and used it for lookup in a hash table (ok) and as a container for the (QObject*, QByteArray), satisfying later references to those parameters from the RestorableId instance instead of using the parameters directly. Now, RestorableId holds the QObject* in a QPointer, so the code might have wanted to detect the object being destroyed as part of the operation, BUT: a) the operation is a read-only one, and b) the code didn't check for nullness before dereferencing the QObject*. Fix by moving the creation of the RestorableId into the scope it's used and otherwise using the parameters directly. Change-Id: Iaf12f722fe6841ee1a55037fe33a6115aa699aca Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Docs: e.g. -> for example in qhash.cppMarc Mutz2015-01-091-2/+2
| | | | | Change-Id: Ifee0117ddadfaa774fdd575467b03ca5b0baf433 Reviewed-by: Martin Smith <martin.smith@digia.com>
* QVersionNumber: use qHashRange()Marc Mutz2015-01-091-7/+1
| | | | | | | Change-Id: Ia7cfb8030cded33f4246206392b46d1013067ef3 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Keith Gardner <kreios4004@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>