summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
Commit message (Collapse)AuthorAgeFilesLines
...
| | | * QtTest: fix UB in QSpontaneKeyEvent::setSpontaneous()Marc Mutz2016-03-071-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found by UBSan: src/testlib/qtestspontaneevent.h:95:38: runtime error: member call on address 0x7ffc33019650 which does not point to an object of type 'QSpontaneKeyEvent' 0x7ffc33019650: note: object is of type 'QMouseEvent' 83 2b 00 00 98 e8 fa 8e 83 2b 00 00 00 00 00 00 00 00 00 00 02 00 04 00 00 00 00 00 00 00 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QMouseEvent' src/testlib/qtestspontaneevent.h:95:38: runtime error: member call on address 0x7ffc330196e0 which does not point to an object of type 'QSpontaneKeyEvent' 0x7ffc330196e0: note: object is of type 'QKeyEvent' 00 00 00 00 f8 e8 fa 8e 83 2b 00 00 00 00 00 00 00 00 00 00 07 00 04 00 00 00 00 00 00 00 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QKeyEvent' Fix by providing setSpontaneous() on QEvent as a private function and befriending QSpontaneKeyEvent. Make setSpontaneous() always-inline to avoid BiC between 5.6.0 and 5.6.1. Change-Id: Ic60d82ed6a858f4f13f41fa3d2d1db6e808896b7 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
| * | | QtCore: use printf-style qWarning/qDebug where possible (I)Marc Mutz2016-03-115-22/+22
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "" with qWarning("..."). Saves ~750b in text size on optimized GCC 5.3 AMD64 builds. Change-Id: I8bf3e46cd5a6b2cae0ceb3e355a50f61925c63d3 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* | | Remove old commentsJędrzej Nowacki2016-03-161-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | Revisions under 7 of moc output are not supported, so there is no point in having comments about them. Change-Id: I31ab1d50750f1c1ddc4b804c333eb3ca96d0b93e Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | Optimize QMetaObject::activate.Milian Wolff2016-03-031-19/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code is restructured to only loop over the non-empty connection lists. This can be checked early while the mutex is locked already, thus removing mutex lock/unlock calls that were done previously just to realize the allsignals list is empty and can be skipped. Additionally, at the very end of the loop over the last signal connection list, the mutex was acquired even though it doesn't need to be as we will quit the loop anyways. This patch leverages these facts to remove the mutex locks which alone has a considerable impact on the corresponding signal/slot benchmark. The instruction count goes down by ca. 13%, while cycle count and runtime drop by about 29%. Before: ********* Start testing of QObjectBenchmark ********* Config: Using QtTest library 5.7.0, Qt 5.7.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.0) PASS : QObjectBenchmark::initTestCase() PASS : QObjectBenchmark::signal_slot_benchmark(simple function) RESULT : QObjectBenchmark::signal_slot_benchmark():"simple function": 0.00000362 msecs per iteration (total: 362, iterations: 100000000) 14.05652884 CPU cycles per iteration (total: 1,405,652,884, iterations: 100000000) 21.00585673 instructions per iteration (total: 2,100,585,673, iterations: 100000000) PASS : QObjectBenchmark::signal_slot_benchmark(single signal/slot) RESULT : QObjectBenchmark::signal_slot_benchmark():"single signal/slot": 0.00004709 msecs per iteration (total: 4,709, iterations: 100000000) 183.75943370 CPU cycles per iteration (total: 18,375,943,371, iterations: 100000000) 362.08604759 instructions per iteration (total: 36,208,604,760, iterations: 100000000) PASS : QObjectBenchmark::signal_slot_benchmark(multi signal/slot) RESULT : QObjectBenchmark::signal_slot_benchmark():"multi signal/slot": 0.00004965 msecs per iteration (total: 4,965, iterations: 100000000) 183.54556242 CPU cycles per iteration (total: 18,354,556,243, iterations: 100000000) 362.07734835 instructions per iteration (total: 36,207,734,835, iterations: 100000000) PASS : QObjectBenchmark::signal_slot_benchmark(unconnected signal) RESULT : QObjectBenchmark::signal_slot_benchmark():"unconnected signal": 0.00000752 msecs per iteration (total: 752, iterations: 100000000) 30.08781366 CPU cycles per iteration (total: 3,008,781,367, iterations: 100000000) 92.01520465 instructions per iteration (total: 9,201,520,466, iterations: 100000000) PASS : QObjectBenchmark::signal_slot_benchmark(single signal/ptr) RESULT : QObjectBenchmark::signal_slot_benchmark():"single signal/ptr": 0.00005620 msecs per iteration (total: 5,620, iterations: 100000000) 219.24739264 CPU cycles per iteration (total: 21,924,739,265, iterations: 100000000) 327.08675555 instructions per iteration (total: 32,708,675,556, iterations: 100000000) PASS : QObjectBenchmark::signal_slot_benchmark(functor) RESULT : QObjectBenchmark::signal_slot_benchmark():"functor": 0.00005852 msecs per iteration (total: 5,852, iterations: 100000000) 218.45401359 CPU cycles per iteration (total: 21,845,401,360, iterations: 100000000) 328.08472410 instructions per iteration (total: 32,808,472,410, iterations: 100000000) PASS : QObjectBenchmark::cleanupTestCase() Totals: 8 passed, 0 failed, 0 skipped, 0 blacklisted, 44469ms ********* Finished testing of QObjectBenchmark ********* After: ********* Start testing of QObjectBenchmark ********* Config: Using QtTest library 5.7.0, Qt 5.7.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.0) PASS : QObjectBenchmark::initTestCase() PASS : QObjectBenchmark::signal_slot_benchmark(simple function) RESULT : QObjectBenchmark::signal_slot_benchmark():"simple function": 0.00000361 msecs per iteration (total: 361, iterations: 100000000) 14.01854817 CPU cycles per iteration (total: 1,401,854,818, iterations: 100000000) 21.00532932 instructions per iteration (total: 2,100,532,933, iterations: 100000000) PASS : QObjectBenchmark::signal_slot_benchmark(single signal/slot) RESULT : QObjectBenchmark::signal_slot_benchmark():"single signal/slot": 0.00003398 msecs per iteration (total: 3,398, iterations: 100000000) 132.52735104 CPU cycles per iteration (total: 13,252,735,104, iterations: 100000000) 314.04965106 instructions per iteration (total: 31,404,965,107, iterations: 100000000) PASS : QObjectBenchmark::signal_slot_benchmark(multi signal/slot) RESULT : QObjectBenchmark::signal_slot_benchmark():"multi signal/slot": 0.00003448 msecs per iteration (total: 3,448, iterations: 100000000) 133.63623046 CPU cycles per iteration (total: 13,363,623,046, iterations: 100000000) 314.04952237 instructions per iteration (total: 31,404,952,238, iterations: 100000000) PASS : QObjectBenchmark::signal_slot_benchmark(unconnected signal) RESULT : QObjectBenchmark::signal_slot_benchmark():"unconnected signal": 0.00000747 msecs per iteration (total: 747, iterations: 100000000) 29.02349389 CPU cycles per iteration (total: 2,902,349,390, iterations: 100000000) 92.01088221 instructions per iteration (total: 9,201,088,222, iterations: 100000000) PASS : QObjectBenchmark::signal_slot_benchmark(single signal/ptr) RESULT : QObjectBenchmark::signal_slot_benchmark():"single signal/ptr": 0.00004350 msecs per iteration (total: 4,350, iterations: 100000000) 167.83581885 CPU cycles per iteration (total: 16,783,581,885, iterations: 100000000) 279.06426656 instructions per iteration (total: 27,906,426,657, iterations: 100000000) PASS : QObjectBenchmark::signal_slot_benchmark(functor) RESULT : QObjectBenchmark::signal_slot_benchmark():"functor": 0.00004337 msecs per iteration (total: 4,337, iterations: 100000000) 170.45074743 CPU cycles per iteration (total: 17,045,074,743, iterations: 100000000) 280.06267229 instructions per iteration (total: 28,006,267,229, iterations: 100000000) PASS : QObjectBenchmark::cleanupTestCase() Totals: 8 passed, 0 failed, 0 skipped, 0 blacklisted, 33228ms ********* Finished testing of QObjectBenchmark ********* Change-Id: I6f79fd68ae7a07d9b439ca047bf1f53c83751d45 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-03-011-2/+2
|\| | | | | | | | | | | Change-Id: Ic7aaa06f4a14b1aed61faa1a6e7f527ee0eeb96b
| * | QVector: preserve capacity in clear()Marc Mutz2016-02-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is what std::vector implementations usually do, because it minimizes memory fragmentation and useless allocations since no user will call clear() unless she intends to append new data afterwards. Fix calls to resize(0) that show how existing code tried to work around the issue. Adjust test. Port from QVERIFY(==) to QCOMPARE as a drive-by. [ChangeLog][QtCore][QVector] clear() now preserves capacity. To shed capacity, call squeeze() or swap with a default-constructed QVector object, see the documentation for an example. Change-Id: I9cebe611a97e027a89e821e64408a4741b31f1f6 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Also search the main bundle plugin path for plugins on Apple OSes.Jake Petroules2016-02-251-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default value of QLibraryInfo::PluginsPath is $prefix/plugins, where $prefix is the path to the bundle's contents directory (for example, .../foo.app/Contents/ on OS X, or .../foo.app/ on iOS). On Apple platforms the directory is actually called "PlugIns". Plugins could previously be loaded on OS X by coincidence, but if the system is using an HFS+ Case Sensitive filesystem (and this is ALWAYS the case on iOS-like operating systems), the case mismatch would cause plugins in an application bundle not to be found/loaded. This change allows plugins to be located in application bundles on Apple platforms regardless of the HFS+ case sensitivity mode and without needing to specify a qt.conf file. Change-Id: Ie0a0f7448fbf5fb410aa77944ba0d01895bb05e3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-02-256-15/+34
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/qt_module.prf src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm Change-Id: I7912c23b02b186831f0e465dbe5d1f9936205439
| * | Perfect (almost) Qt on Android splash screen.BogDan Vatra2016-02-242-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no need to show the splash image immediately when the application starts, because it will be removed shortly in QtActivityDelegate.java, therefore show the splash in QtActivityDelegate.java. This patch also adds a new option to AndroidManifest.xml which keeps the splash screen visible until user to decides to hide it, by using the QtAndroid::hideSplashScreen() function. Change-Id: I8a29a5a757d626c4c9d6a2748a60ca3091ebf82d Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-241-9/+10
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java src/plugins/platforms/windows/qwindowsfontengine.cpp src/plugins/platforms/windows/qwindowsnativeimage.cpp tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I649b32b260ce0ed2d6a5089021daa0d6a8db85f7
| | * doc: Clean up old references to QApplication for GUI applicationEskil Abrahamsen Blomfeldt2016-02-191-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Qt 5.0, there's been a separation between QGuiApplication for generic GUI applications, and QApplication for applications using Qt Widgets. The docs in QCoreApplication has not reflected this, however, and was still recommending QApplication for any GUI app. Change-Id: I7b2b166170d1e20755889767cda3d555fbbc666a Reviewed-by: Martin Smith <martin.smith@theqtcompany.com> Reviewed-by: Nico Vertriest <nico.vertriest@theqtcompany.com>
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-183-5/+15
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * Wrap legacy APIs in a QT_MAC_DEPLOYMENT_TARGET_BELOW macro.Jake Petroules2016-02-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | If the deployment target is OS X >= 10.10 or iOS >= 8.0, we always have the NSProcessInfo API available and do not need to compile-in this code at all. Change-Id: I8470a5be475a82e7b88d62f4558925f62527b6f6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
| | * Merge remote-tracking branch 'origin/5.6.0' into 5.6Liang Qi2016-02-152-5/+13
| | |\ | | | | | | | | | | | | Change-Id: I0b190005377a23a91da3563428e223b8a3b18333
| | | * Fix livelock at application exit if threads were runningThiago Macieira2016-02-022-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This only happened in debug mode, though, because in release mode the warning wasn't printed and the socket notifier was removed. In debug mode, this loop in closingDown() never exited: while (!d->sn_read.isEmpty()) unregisterSocketNotifier((*(d->sn_read.begin()))->obj); [ChangeLog][QtCore][QThread] Fixed a bug that would cause debug-mode applications to live lock on exit if they had a global static containing a QThread that wasn't properly exited. Task-number: QTBUG-49870 Change-Id: I7a9e11d7b64a4cc78e24ffff142e457a4540d6b6 Reviewed-by: Mat Sutcliffe <oktal3700@gmail.com> Reviewed-by: Roland Winklmeier <Roland.M.Winklmeier@gmail.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* | | | Merge remote-tracking branch 'origin/5.7' into devSimon Hausmann2016-02-192-2/+54
|\| | | | | | | | | | | | | | | Change-Id: I7bee7df50af3d607a349b68103cd2c67791281fb
| * | | Merge "Merge dev into 5.7" into refs/staging/5.7Oswald Buddenhagen2016-02-174-24/+50
| |\ \ \
| * | | | Say hello to Android ServicesBogDan Vatra2016-02-172-2/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changeset enables running a QCoreApplication from within an Android Service. The Android Application running can now have a QtActivity or a QtService, but having both in the same process is not supported. This patch was based on Cory Slep's patch [ChangeLog][Android] Qt can now be used to easily create Android Services. Task-number: QTBUG-37221 Change-Id: I0fd693daaa85b991940ffe9cc41c483022677199 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* | | | | Factor out usage of a private symbol by the iOS platform plugin.Jake Petroules2016-02-192-4/+10
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a link error due to symbol visibility when the iOS platform plugin is built as a shared library. Change-Id: I0b454c5c5033c6b598cede11ce5e3a85e5704c4a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* | | | Microoptimize QObject::activate.Milian Wolff2016-02-161-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes temporary variables that are not used in all cases. This reduces the instruction count per iteration for the corresponding benchmark by 1 or 2. Before: ********* Start testing of QObjectBenchmark ********* Config: Using QtTest library 5.7.0, Qt 5.7.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.0) PASS : QObjectBenchmark::initTestCase() PASS : QObjectBenchmark::signal_slot_benchmark(simple function) RESULT : QObjectBenchmark::signal_slot_benchmark():"simple function": 21.0065466 instructions per iteration (total: 210,065,466, iterations: 10000000) PASS : QObjectBenchmark::signal_slot_benchmark(single signal/slot) RESULT : QObjectBenchmark::signal_slot_benchmark():"single signal/slot": 405.0829559 instructions per iteration (total: 4,050,829,559, iterations: 10000000) PASS : QObjectBenchmark::signal_slot_benchmark(multi signal/slot) RESULT : QObjectBenchmark::signal_slot_benchmark():"multi signal/slot": 405.0812465 instructions per iteration (total: 4,050,812,465, iterations: 10000000) PASS : QObjectBenchmark::signal_slot_benchmark(unconnected signal) RESULT : QObjectBenchmark::signal_slot_benchmark():"unconnected signal": 104.0147348 instructions per iteration (total: 1,040,147,349, iterations: 10000000) PASS : QObjectBenchmark::signal_slot_benchmark(single signal/ptr) RESULT : QObjectBenchmark::signal_slot_benchmark():"single signal/ptr": 369.1021099 instructions per iteration (total: 3,691,021,100, iterations: 10000000) PASS : QObjectBenchmark::signal_slot_benchmark(functor) RESULT : QObjectBenchmark::signal_slot_benchmark():"functor": 370.0982862 instructions per iteration (total: 3,700,982,862, iterations: 10000000) PASS : QObjectBenchmark::cleanupTestCase() Totals: 8 passed, 0 failed, 0 skipped, 0 blacklisted, 6036ms ********* Finished testing of QObjectBenchmark ********* After: ********* Start testing of QObjectBenchmark ********* Config: Using QtTest library 5.7.0, Qt 5.7.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.0) PASS : QObjectBenchmark::initTestCase() PASS : QObjectBenchmark::signal_slot_benchmark(simple function) RESULT : QObjectBenchmark::signal_slot_benchmark():"simple function": 21.0061664 instructions per iteration (total: 210,061,664, iterations: 10000000) PASS : QObjectBenchmark::signal_slot_benchmark(single signal/slot) RESULT : QObjectBenchmark::signal_slot_benchmark():"single signal/slot": 403.0829161 instructions per iteration (total: 4,030,829,162, iterations: 10000000) PASS : QObjectBenchmark::signal_slot_benchmark(multi signal/slot) RESULT : QObjectBenchmark::signal_slot_benchmark():"multi signal/slot": 403.0836305 instructions per iteration (total: 4,030,836,305, iterations: 10000000) PASS : QObjectBenchmark::signal_slot_benchmark(unconnected signal) RESULT : QObjectBenchmark::signal_slot_benchmark():"unconnected signal": 104.0150038 instructions per iteration (total: 1,040,150,039, iterations: 10000000) PASS : QObjectBenchmark::signal_slot_benchmark(single signal/ptr) RESULT : QObjectBenchmark::signal_slot_benchmark():"single signal/ptr": 368.0981987 instructions per iteration (total: 3,680,981,988, iterations: 10000000) PASS : QObjectBenchmark::signal_slot_benchmark(functor) RESULT : QObjectBenchmark::signal_slot_benchmark():"functor": 369.1179429 instructions per iteration (total: 3,691,179,429, iterations: 10000000) PASS : QObjectBenchmark::cleanupTestCase() Totals: 8 passed, 0 failed, 0 skipped, 0 blacklisted, 5975ms ********* Finished testing of QObjectBenchmark ********* Change-Id: Iba3bffbca5b58109816c8b1a7dea0796b18c8785 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | | Share code between const and non-const QMetaObject::cast variants.Milian Wolff2016-02-161-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I7aad8e5060bb17ebc04fdb137dad3b6d167895a8 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | | Add qOverload to select overloaded functionsPeter Kümmel2016-02-151-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][Global] qOverload added to select overloaded functions. Change-Id: I7c9b1b054e6631eca0b5594db59e1202ef552c33 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | | Fix for deferredDelete() bug when calling the glib loop directlyPaolo Angelelli2016-02-122-11/+37
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes sure that all events posted using Qt on top of the GLib event loop have the loopLevel counter incremented. This is done since Qt depends on the fact that all deleteLater() calls are issued within the scope of some signal handler (in other words, triggered by the chain sendEvent() -> notifyInternal2()). There is a side effect though: in the conditions affected by this patch, that is deleteLater()s issued within a glib event handler for example, manually calling processEvents() or sendPostedEvents() with or without the QEvent::DeferredDelete flag has the same effect, and deferred deleted events are always processed. While this is not a currently working feature which the patch breaks, this side effect seems to be difficult to avoid without separating sendPostedEvents() and processEvents() into a public and a private method, in order to detect when they are manually called. Such change could perhaps be done for Qt6. An autotest for QTBUG-36434 is also included. Autotesting for QTBUG-32859 seems to be more challenging in this respect, due to its dependency on GLib. Task-number: QTBUG-18434 Task-number: QTBUG-32859 Task-number: QTBUG-36434 Change-Id: Ib89175aa27c9e38bca68ae254d182b2cd21cf7e9 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-02-111-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qfilesystemwatcher_win.cpp src/corelib/plugin/plugin.pri src/plugins/platforms/cocoa/qcocoaaccessibility.mm tests/auto/corelib/tools/qlocale/tst_qlocale.cpp Change-Id: Id6824631252609a75eff8b68792e4d10095c8fc1
| * | Removed redundant and distracting test from conditional.Edward Welbourne2016-02-041-1/+1
| |/ | | | | | | | | | | | | | | | | | | If argumentTypes is NULL then it is indeed not equal to the address of a local static variable, so there is no need to follow the NULL-check with a check that it's not equal to that non-NULL address. Change-Id: I62362db747c0620b2195f7997368f026f535d57c Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | Remove qt_safe_select and qt_select_msecsLouai Al-Khanji2016-02-052-58/+0
| | | | | | | | | | Change-Id: If46228dc750554b65acd23e48410ec541fc33714 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Clean up new poll code slightlyLouai Al-Khanji2016-02-043-23/+20
| | | | | | | | | | Change-Id: I046126ff69a77a50e79efb1b6ebb0fffef67ac8e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Android: Add runOnAndroidThreadSyncBogDan Vatra2016-02-042-0/+12
| | | | | | | | | | | | | | This is a convenient function which waits (timoutMS) for the runnable to be executed. Change-Id: I2c0f262d3795c29961e8182b7ffc35a2c6f8a1f6 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* | QProcess: Use poll instead of select on Unix platformsLouai Al-Khanji2016-02-032-0/+16
| | | | | | | | | | Change-Id: I3386ef228ce95209f6f221e18293d991b24a7b2e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-02-024-4/+158
|\| | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/compile.test src/plugins/platforms/cocoa/qcocoahelpers.mm src/tools/qlalr/cppgenerator.cpp Change-Id: I0103ca076a9aca7118b2fd99f0fdaf81055998c3
| * Fix memory leak if QMetaType::create is called for an unknown typeJędrzej Nowacki2016-02-011-2/+3
| | | | | | | | | | | | | | | | The memory should be allocated only if we operates on a valid type, It is a regression introduced by 3d575d4845926bd141ff0c14e57427bba79644d0 Change-Id: Ia31bccd5b41fe090c29df1aeaa69efb706cd25bb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Move Cocoa key code helper functions to QtCoreTor Arne Vestbø2016-01-292-0/+153
| | | | | | | | | | | | | | | | Can be useful for e.g. testlib for handling native key events. Change-Id: I6560c6e28799e25eb3bdcaa0f2ca3c17644c62db Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
| * Bump copyright year to 2016Kai Koehne2016-01-291-2/+2
| | | | | | | | | | | | | | | | | | | | Bump copyright year in tool output and user visible strings to 2016. Task-number: QTBUG-50578 Change-Id: I2f4aa9089c6672726f554cba7e6009b425d27683 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com> Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com> Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
* | QEventDispatcherUNIX: Clean up thread_pipe logicLouai Al-Khanji2016-01-292-80/+111
| | | | | | | | | | Change-Id: Ic13ad54a5b3c7bd3e3e5921b3dbbe321690fad21 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QTranslator: optimize string and char usageAnton Kudryavtsev2016-01-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | Port a QString::fromLatin1() to QStringLiteral. The string is never modified. Wrap char in QLatin1Char to construct a QChar with 8-bit character. Change-Id: I579ca9eae0c2a72ea893254f258b001063e9f64e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QEventDispatcherUNIX: Use poll instead of selectLouai Al-Khanji2016-01-262-324/+206
| | | | | | | | | | | | | | This allows us to support file descriptors >= FD_SETSIZE. Change-Id: I7e4a35333446a587cfd13c077fa5e19fa3d1abc4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-261-7/+9
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java src/dbus/qdbusconnection_p.h src/dbus/qdbusintegrator.cpp src/dbus/qdbusintegrator_p.h tests/auto/corelib/io/qdir/qdir.pro tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp Change-Id: I3d3fd07aed015c74b1f545f1327aa73d5f365fcc
| * Q*Application: don't allocate memory just to compare C stringsMarc Mutz2016-01-231-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of creating a QByteArray, possibly normalizing a leading '--' (one allocation, plus possibly one copy), simply use the old 'ol str(n)cmp, skipping the first character if the argument starts with '--'. It also fixes parsing of -stylesheet and other options which were erroneously parsed using indexOf() != -1, when they should have used startsWith(). Also saves 504/742/522b in text size for QtCore/QtGui/QtWidgets, resp., on optimized GCC 5.3 Linux AMD64 builds. Change-Id: Ida868badac3fb9b77285417ee537c861ccc4fc06 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge "Merge remote-tracking branch 'origin/5.6' into dev" into refs/staging/devLiang Qi2016-01-265-63/+81
|\ \
| * | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-215-63/+81
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qiodevice_p.h src/corelib/kernel/qvariant_p.h src/corelib/tools/qsimd.cpp src/gui/kernel/qguiapplication.cpp tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp Change-Id: I742a093cbb231b282b43e463ec67173e0d29f57a
| | * Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2016-01-194-16/+42
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config.tests/common/atomic64/atomic64.cpp configure src/3rdparty/forkfd/forkfd.c src/corelib/io/forkfd_qt.cpp src/widgets/kernel/qwidgetwindow.cpp tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp tools/configure/configureapp.cpp Change-Id: Ic6168d82e51a0ef1862c3a63bee6722e8f138414
| | | * Fix UB in QVariant::canConvert()Marc Mutz2016-01-111-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'currentType' was not sanitized before being used as a shift. Fix by checking for a valid shift amount before shifting. Also change the shifted value from 1 (int) to 1U (uint). It's just the right thing to do. Found by UBSan: qtbase/src/corelib/kernel/qvariant.cpp:3131:59: runtime error: shift exponent 1114 is too large for 32-bit type 'unsigned int' Change-Id: Id3910d6d7f166fd7c80adf5ce1699f0eeb453562 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | | * Allow socket events processing with a foreign event loop on WindowsAlex Trotsenko2016-01-052-13/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While a native dialog is open, the application message queue is handled by the native event loop which is external to Qt. In this case, QEventDispatcherWin32::processEvents() does not run and socket notifiers will not be activated. So, this patch moves the notifier activation code into the window procedure, which enables socket event processing with native dialogs. Task-number: QTBUG-49782 Task-number: QTBUG-48901 Change-Id: Icbdd96b2e80c50b73505f4fe74957575b83d6cf1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
| | | * Add explicit note about removeMappings() not disconnecting the signalAndy Shaw2015-12-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There can be a bit of confusion here regarding what removeMappings() will do in this case so add an explicit note to be clearer. Task-number: QTBUG-49499 Change-Id: Iabcf5cb2653f0b747727b2c92a244e95ec1836f8 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
| | * | Fix GCC 6 warning about placement-new operator on too little spaceThiago Macieira2016-01-121-18/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC 6 is able to detect when you use a placement new of an object in a space that is too small to contain it. qvariant_p.h: In instantiation of ‘void v_construct(QVariant::Private*, const T&) [with T = QRectF]’: qvariant_p.h:142:9: error: placement new constructing an object of type ‘QRectF’ and size ‘32’ in a region of type ‘void*’ and size ‘8’ [-Werror=placement-new] new (&x->data.ptr) T(t); ^~~~~~~~~~~~~~~~~~~~~~~ This happens even for the false branch of a constant expression (the enum). So split the v_construct function in two pairs, one pair for being able to use the internal space and one pair not so. Change-Id: Ibc83b9f7e3bc4962ae35ffff1425ed898f279dea Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
| | * | QVariant: use v_construct instead of duplicating logicThiago Macieira2016-01-121-31/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | v_construct does what we want, so use it. This is required for the next commit, which solves a GCC 6 warning issue. Change-Id: Ibc83b9f7e3bc4962ae35ffff1425ed5f035f631a Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
| | * | QVariant: make sure to default-initialize in v_constructThiago Macieira2016-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise it's possible to get garbage for primitive types (trivially constructible) under some conditions. Change-Id: I408dcb81ba654c929f25ffff142885fc62395948 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | | QTranslator: don't re-create QString each time through a loopAnton Kudryavtsev2016-01-261-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just cache it. Also port to QStringLiteral, because the string is never modified. Since the string literal is used in more than one function, to avoid duplication of .rodata, wrap the QStringLiteral in an inline function. Change-Id: Ib5aede9f129610c80d122939afc343c938cc8e48 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | | QVariant: replace QLatin1String with QStringLiteralAnton Kudryavtsev2016-01-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ... in convert() to optimize string creation. Change-Id: Id012f2f52606c026ed216655ff3ce63bd5154da6 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | | QMimeData: use reserve in formats()Anton Kudryavtsev2016-01-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ... to optimize memory allocation. Change-Id: I039a6de6f97858f339b83ca7e3e361963eaa61ee Reviewed-by: Marc Mutz <marc.mutz@kdab.com>