summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | QStaticByteArrayMatcher: fix MSVC warningMarc Mutz2017-02-231-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | MSVC 2013 complained: src/corelib/tools/qbytearraymatcher.h(143) : warning C4351: new behavior: elements of array 'QStaticByteArrayMatcher<6>::m_pattern' will be default initialized Fix the same way as 9a07ab9234ccb4ed0d6aa3a64b4b2c888635dae5: by suppressing the warning. Change-Id: Ic41f7eabe7e39709d76e6062f5891cdcfaa6e1ed Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | QSizePolicy: make (Policy,Policy) ctor constexprMarc Mutz2017-02-232-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, that ctor also takes a ControlType argument (defaulted), and calls the non-constexpr, non-inline function setControlType(). In order to make at least the two-arg version constexpr, I added a use of the ternary operator to check for type == DefaultType, making all calls of the ctor that use type == DefaultType constexpr. For init'ing an aggregate type without ctor in the ctor-init-list, I needed to require uniform initialization, too. C++11-style constexpr cannot call void functions, so I needed to extract the transformation part of setControlType() into a new function that returns the result instead of storing it directly. Saves a surprising 2K in QtWidgets text size on GCC 4.9, AMD64 Linux stripped release builds. Change-Id: Ib4adf5fd6e54d5345dbfe1c298554278faf13c58 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | QTypeInfo: record whether it was specializedMarc Mutz2017-02-231-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is one of the pillars of my static container checking toolbox, one of the main checks being that every type put into a Qt container has been marked up with Q_DECLARE_TYPEINFO. Obviously, we cannot upstream such a checker and inflict it upon the world, but we can put some foundations in. This is the most central one. Change-Id: I9185facb2f37ba9fcc12c9aae5675eed454d755c Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QErrorMessage: replace a QPair with a structMarc Mutz2017-02-221-5/+11
| | | | | | | | | | | | | | | | Instead of the incomprehensible "names" .first and .second, the code can now use .content and .type. Change-Id: I7fe320ded33a07fb8ff77ac96c17fc5ee1079da3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | QThreadPool: supersede cancel() with tryTake()Marc Mutz2017-02-223-18/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The cancel() function added in 5b11e43e for Qt 5.5 suffers from a number of problems: First, if runnable->autoDelete() is true, then the function suffers from the ABA problem (see documentation written for trytake()). Second, if runnable->autoDelete() is false, due to cancel() throwing away crucial information instead of returning it, the caller cannot know whether the runnable was canceled (and thus has to be deleted), wasn't found or is currently executing (and thus mustn't be deleted), or has finished executing (and can be used to extract the result). Deprecate this dangerous API and replace it with the much more useful Private::stealRunnable(), promoted to public API and renamed to tryTake() for consistency with the rest of Qt. Described the various caveats in the function's documentation. [ChangeLog][QtCore][QThreadPool] The cancel() function suffers from several subtle issues and has been replaced with a new tryTake() function. Change-Id: I93125935614087efa24b3e3969dd6718aeabaa4f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Fix wrong access to qMemRotateFunctionsAllan Sandfeld Jensen2017-02-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | Since this table was restructured in 7c401397a4 and changed to being indexed bitwidth and not format, NEON-enabled builds have been writing to an undefined place after the table. Discovered by compiler warnings on CI. Change-Id: I109cd19a8dd703bdafdf13afd3f96ebeaa0e6de5 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | QTypeInfo: don't treat enums and (extended) integral types as complexMarc Mutz2017-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We fully specialize QTypeInfo for most C++ built-in types, but enums and extended integral types (like GCC's int128_t) were not covered. Now that we depend on <type_traits>, we can stop pessimizing enums and extended integral types in QVector and QVLA by defaulting QTypeInfo::isComplex to true for such types. Fix a test that checked that enums were complex types. This should have been a XFAIL test. Enums are not complex types. Change-Id: Ibb0fb38cc83e980a428b5573d1db5666593418ae Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Do not use QTypeInfo::isStatic anymoreMarc Mutz2017-02-223-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... except in QList. When dafa3618 introduced isRelocatable and QTypeInfoQuery, the intention was to decouple the memory layout of QList from the reallocation optimizations in QVector. This never happened, as QVector (and QVarLengthArray) continue to use isStatic to this day. Fix by porting both QVector and QVLA to QTypeInfoQuery and isRelocatable. Change-Id: I6951f2cf21f0cbb24e2dbd38f80f1bd82007d394 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QArrayDataOps: don't use value-initializationMarc Mutz2017-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | ... but default-initialization instead. This bug may have rendered the diverse Qt::Uninitialized ctors we have in Qt containers ineffective. Change-Id: I5a369fa8527f19b6f8cc1a9f36512f6a0058839a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | macOS: Make sure NSResizableWindowMask is set when toggling fullscreenTor Arne Vestbø2017-02-222-14/+30
| | | | | | | | | | | | | | | | | | | | | | | | Instead of setting the mask in toggleFullScreen(), which is only hit when going to fullscreen via our own API, we do it in the window notification callbacks, which also includes going to full screen via the native macOS title bar buttons. This allows making customized windows without Qt::WindowMaximizeButtonHint full screen with the full geometry of the screen. Change-Id: I63c3e4582ea7c4fe8c0008265793c5f656b830b2 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | QTzTimeZonePrivate: introduce PosixZone classMarc Mutz2017-02-221-26/+43
| | | | | | | | | | | | | | | | | | | | | | | | ... as a replacement for QPair<QString, int>, and move some repsonsibilities into it. This avoids the repeated use of the magic number INT_MIN to indicate absence of an offset and does away with the confusing .first and .second, replacing them instead with proper names, .name and .offset. Change-Id: I0f6906467b8efa16bed2bf5677f2bbbd534da1ae Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QWindow: Remove "_q_foreignWinId" dynamic propertyTor Arne Vestbø2017-02-2218-64/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The platform plugins reading this out of the QWindow was a layering violation, and propagates the notion that a window can shape shift into representing a new native handle, while none of the platform plugins support this. A foreign QWindow is created via the factory function fromWinId(), at which point we can pass the WId all the way to the platform plugin as function arguments, where the platform will create a corresponding platform-window. The platform window can then answer the question of whether or not it's representing a foreign window, which determines a few behavioral changes here and there, as well as supplying the native window handle back for QWindow::winId(); [ChangeLog][QtGui][QWindow] The "_q_foreignWinId" dynamic property is no longer set nor read. [ChangeLog][QtGui][QPA] The function createForeignWindow() has been added to QPlatormIntegration and is now responsible for creating foreign windows. The function isForeignWindow() in QPlatformWindow has been added, and platforms should implement this to return true for windows created by createForeignWindow(). Task-number: QTBUG-58383 Change-Id: If84142f95172f62b9377eb5d2a4d792cad36010b Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | Fix a race condition between QObject::connect and qRegisterMetaTypeOlivier Goffart2017-02-221-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QObject::connect will extract the QArgumentType for first the signal, then the slot. The QArgumentType with a string constructor will query the metatype system to get the meta type id. But it might happen that between the extraction of the signal's argument and the slot's argument, qRegisterMetaType was called in another thread. For this reason, it's possible that one QArgumentType has a type id while the other does not. For this reason, we should fall back to compare the string if any of the argument's type is 0. Task-number: QTBUG-50901 Change-Id: I260ca662ff00a773ae519f78bb633e05fde0ea81 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QSizePolicy: add C++14-style constexpr where possibleMarc Mutz2017-02-221-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is straight-forward, since, unlike with transposed(), we can assume that every compiler that supports C++14 constexpr also supports C++11 uniform initialization. For Clang and GCC, this is clear. For MSVC, we might need to reconsider this, as, according to qcompilerdetection.h, 2015 still does not support uniform initialization (but not C++14 constexpr, either), and we don't know what 2017 will support. Change-Id: Idac7aa929d275645478a926896dca0dff166e114 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QArrayDataOps: do not use QTypeInfo::isStatic anymoreMarc Mutz2017-02-221-2/+2
| | | | | | | | | | | | | | These days, QTypeInfoQuery and isRelocatable should be used. Change-Id: Ieac2d7fcef6b1d5466b14bbd1066901d6e751a55 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | testlib: Add qWaitFor to wait for predicateTor Arne Vestbø2017-02-214-29/+64
| | | | | | | | | | | | | | | | Reduces duplication of logic and allows other primitives to be built on top. Change-Id: Ia100014cfb0c09ac2f47c3a156d0c76f0fddafa8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QErrorMessage: handle all message typesMarc Mutz2017-02-211-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The perils of adding a default: case to a switch over an enum type: the compiler no longer warns when the enum is extended. Provide strings for QtCriticalMsg and QtInfoMsg, too. [ChangeLog][QtWidgets][QErrorMessage] No longer displays critical (QtCriticalMsg) and informational (QtInfoMsg) messages as if they were debug (QtDebugMsg) ones. Change-Id: Id6776081be736ad92423ec016988dcd92a963cc7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | macOS: Retain foreign windowsTor Arne Vestbø2017-02-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Regression after 89842b97d74d1, where the retain was part of setView. We release m_view in the destructor, regardless of how the view was acquired, and the non-foreign window retains by being the one creating the view. Task-number: QTBUG-59001 Change-Id: I6d9621a63ea6ec2cee008986b0ab72ff61110ad7 Reviewed-by: René J.V. Bertin <rjvbertin@gmail.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | QtGui: port the last remaining Q_FOREACH loops and add QT_NO_FOREACHMarc Mutz2017-02-203-3/+3
| | | | | | | | | | | | | | | | | | Port the last two remaining Q_FOREACH users in QtGui to C++11 range-for and mark the library as Q_FOREACH -free, using QT_NO_FOREACH. Change-Id: Ie6c5eea0af4227af6ef3dc0b4da2cf62e09d8b52 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | QWidget: update the font when the screen is changedOlivier Goffart2017-02-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The screen may change the dpi so the font dpi is also changed. We must tell QWidget that the font has changed by sending the FontChanged event to all sub widgets so they can update their geometry. Task-number: QTBUG-48242 Change-Id: Ibcdcc0c96429b8cd16311928298294f47a23e816 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Only define "accessibility" feature oncePaul Olav Tvete2017-02-202-3/+10
| | | | | | | | | | | | | | | | The "accessibility" feature was defined globally for qtbase, but also in src/gui. The definitions could end up with different values. Change-Id: I1a932c3c04a5fc26b9f67eb4f5ff02e524f380e7 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Make better use of new QStringList::join(QLatin1String) overloadMarc Mutz2017-02-194-5/+5
| | | | | | | | | | | | | | | | It was added in Qt 5.8. Change-Id: I7194fbfaef9219110604f3b03a893a658c996c06 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | qeglfskmsegldevicescreen.cpp: add errno.h includeDavid Faure2017-02-181-0/+1
| | | | | | | | | | | | | | | | | | Compilation failed with clang 3.9.1: qeglfskmsegldevicescreen.cpp:104:27: error: use of undeclared identifier 'errno' qErrnoWarning(errno, "drmModeSetCrtc failed"); Change-Id: I7cf08494359092b9cdac10bb013ac56c3ddf5597 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Widgets: Update micro focus in QLineEdit and friendsJarkko Koivikko2017-02-174-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | QLineEdit, QAbstractSpinBox and QComboBox did not notify micro focus changes to the input context. In particular, the updates were missed during pre-edit stage. This change adds the missing bindings to QWidget::updateMicroFocus(). Change-Id: I9a7fff962f46dbabd8fb02836c206bace115793b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Fix typo in apidoc.Frederik Schwarzer2017-02-171-1/+1
| | | | | | | | | | | | Change-Id: Ibd71c1ed653769637aa176dfb52c4594141be8ce Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | Build fix for new feature -qt-no-processenvironmentPaul Olav Tvete2017-02-171-1/+1
| | | | | | | | | | | | Change-Id: I6d1c5d122761d239d96b943a9abf7af12195a3eb Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | Build fix for -no-feature-datestringPaul Olav Tvete2017-02-171-1/+3
| | | | | | | | | | Change-Id: I09c7bc360956aef44f4137a093b6329a08a099ee Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | xcb: support graphics tablets with the "uc-logic" nameDmitry Kazakov2017-02-171-0/+3
| | | | | | | | | | | | | | | | | | | | Similar to support for the other Genius tablets. https://bugs.kde.org/show_bug.cgi?id=359642 Task-number: QTBUG-52626 Change-Id: I3e2033d547d8bab4b6fb93be3a172bdce4fc5666 Reviewed-by: Dmitry Kazakov <dimula73@gmail.com> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | Merge "Merge remote-tracking branch 'origin/5.8' into 5.9" into refs/staging/5.9Liang Qi2017-02-1723-176/+132
|\ \
| * | Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-02-1623-176/+132
| |\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/plugin/qlibrary_unix.cpp src/plugins/platforms/xcb/qxcbconnection.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp Change-Id: I632c400d909f8c204f55743aadc7886af2f15dfb
| | * QNetworkSession - register types before connecting slotsTimur Pocheptsov2017-02-161-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QNetworkSession's ctor has a race condition: it 1) connects signals/slots and also 2) registers meta-types (but after these connects). Our users apparently have a lot of per-thread QNAMs in multiple threads (and implicitly many QNetworkSessions on different threads too). From error logs it appears that while one thread tries to connect signals/slots and evaluates the types of signal and slot arguments, another thread can register this type. If the first thread extracted signal argument types, then the second registered this type, we can end up in a 'type mismatch' error on the first thread with seemingly the same types in a debug message (something like "type mismatch A::Some <-> A::Some") - they have the same name, but one has type() == 0 and another - some non-zero type(). Now we call qRegisterMetaType before connect. Task-number: QTBUG-50901 Change-Id: Idbb9515573e174bbc5e5bf55dc3a7911a81646ea Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| | * Eliminate QT_NO_DYNAMIC_LIBRARYUlf Hermann2017-02-162-23/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | The library feature already covers this. As library depends on the dlopen compile check, we can assume dlopen to be available, also on vxworks. Change-Id: Idcdb07ab4688c6158651d9a5ad5e2ba126bd7d9e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
| | * QReadWriteLock: make field 'recursive' constMarc Mutz2017-02-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is never written after initialization, and accessed concurrently outside mutex protection, so make sure that it never changes by marking it as const. Change-Id: Ib28b2e8b3067d596a95d1699165a6ebfb15fe674 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| | * QJNIHelpers: unbreak runnables counterMarc Mutz2017-02-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding 0 each time will obviously not produce a new identifier each time... Also use static initialization for QBasicAtomicInt. A default-constructed static QBasicAtomicInt at function scope will be dynamically initialized. It will still be zero-initialized, but at least GCC adds guard variables for such objects. When using aggregate initialization, the guard disappears. Amends 265db5ad9bda9c984393c1e95fd27dcc4633ed1c. Change-Id: Ia71290cf26c486dcbcc74381f12cd0c4712d6019 Reviewed-by: David Faure <david.faure@kdab.com>
| | * xcb: Allow to disable XInput 2 support by setting QT_XCB_NO_XI2 env varAlexander Volkov2017-02-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use of XInput 2 may result in regressions. For example we call XISelectEvents for each window every time a device plugs/unplugs. It causes significant delays when there are many native windows. Change-Id: I60b799bb667d0e4bca1f9c52cdaa07b04bcc749f Task-number: QTBUG-57013 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
| | * qcssparser: Undef TILDE to fix compilation on HurdDmitry Shachnev2017-02-151-0/+4
| | | | | | | | | | | | | | | | | | Change-Id: Ic3168629565618bcd7f26e47579beaa1bbd22e39 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| | * Use Qt::PreciseTimer for the QDeadlineTimers in QTest::qWait*Thiago Macieira2017-02-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | QDeadlineTimer will eventually support CLOCK_MONOTONIC_COARSE on Linux, so let's be safe before that change appears. Change-Id: I9b423f1b71194205b27afffd14a383a7e9f66a9d Reviewed-by: Stéphane Fabry, Cutesoft <stephane.fabry@gmail.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
| | * Remove the name cache from QMetaType::typeNameThiago Macieira2017-02-151-25/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was unnecessary, since we only cached the static types, which are all generated by the macro anyway. The way it was implemented, this produced data races that are strictly-speaking UB, even if all the threads were writing the same values to the same data locations. This commit changes a little the code to simplify, since we're changing those lines anyway. Task-number: QTBUG-58851 Change-Id: Idc5061f7145940f987dffffd14a30047846e3113 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| | * Doc: fixed explanation in Qt::Tool documentationSamuel Gaist2017-02-151-1/+1
| | | | | | | | | | | | | | | | | | | | | Clarify the the macOS implication of the flag. Change-Id: Ic68e1ac668cfa68abf868ba6bdd46241dfa9b9a7 Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
| | * QJNIHelpers: make mutexes staticMarc Mutz2017-02-151-2/+2
| | | | | | | | | | | | | | | | | | | | | Amends 265db5ad9bda9c984393c1e95fd27dcc4633ed1c. Change-Id: I707bb88285531ee9f82efec46901871d53413eb3 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
| | * QFileDialog: Protect against nullptr dereferenceKevin Funk2017-02-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the QFileDialog receives a language change event, and native dialogs are used, this code path dereference a nullptr in the qFileDialogUi member. Protect by checking the return value of QFileDialogPrivate::usingWidgets() as done in other places deferencing qFileDialogUi. Fixes a crash in GammaRay Change-Id: I3e9eb81c75d9fc983519a58c5ec06e316ac80263 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| | * Fix indentation of source code example in docsFrederik Schwarzer2017-02-151-8/+8
| | | | | | | | | | | | | | | Change-Id: Icf94c9adc55d16acd26831cce331054a8c49652d Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
| | * Fix UB (data race) in QtAndroidPrivate::requestPermissionsSync()Marc Mutz2017-02-151-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the QSemaphore::tryAcquire() call times out, we mustn't touch *res, because there was no happens-before relation established between *res = result in the lambda and our returning *res; Fix by returning a default-constructed hash in that case. Add a strategic std::move(). The same problem exists in runOnAndroidThreadSync(), but I have no idea how to solve it, because there the shared object is the runnable itself. Change-Id: I9a2c431144c169fbd545763555d96153143a11bf Reviewed-by: BogDan Vatra <bogdan@kdab.com>
| | * QJNIHelper: fix a potential race in sendRequestPermissionsResult()Marc Mutz2017-02-151-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code obtained an iterator into a QHash under mutex protection, then dropped the lock, dereferenced the iterator several times and only retook the lock to erase the element from the QHash. This is very smelly. QHash provides no official iterator validity guarantees, and the container isn't const, either (which would imply thread-safety). In particular, the dereference into the container outside the critical section is cause for concerns. Simplify the code, removing any doubts about its race-freedom, by taking the payload item out of the hash before dropping the lock, and using only the local strong reference in the remainder of the function. The only other references to g_pendingPermissionRequests are insertions with unique-by-construction keys in QtAndroidPrivate's requestPermissions(), so there was no reason to keep the item in the hash for the whole duration of the sendRequestPermissionsResult() call. Change-Id: I39fe0803b13b3046d1f0fd9c8e96c531406d57da Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: BogDan Vatra <bogdan@kdab.com>
| | * Update QSyntaxHighlighter docs to use QRegularExpressionAaron Linville2017-02-152-60/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update the QSyntaxHighlighter examples to use the new QRegularExpression class in place of QRegExp. Fix typos. Remove duplicated snippet. Replace lengthy section of duplicate text in highlight(..) with a note to see the detailed description. Task-number: QTBUG-58494 Change-Id: Id8d94bddbed52e6e52feac107f6fc84e2fe4518a Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch> Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
| | * Enable QtAndroid::runOnAndroidThread in a ServiceHeikki Haveri2017-02-152-6/+17
| | | | | | | | | | | | | | | Change-Id: I214f5dc70c52011a5e1712ea70f97f8b564fb664 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
| | * Turn QThreadData::threadId into a QAtomicPointerThiago Macieira2017-02-155-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Solves a data race found by TSan. Since thread and threadId are QAtomicPointer, I've removed the explicit initialization in the QThreadData constructor Task-number: QTBUG-58855 Change-Id: I4139d5f93dcb4b429ae9fffd14a34082f2683f76 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| | * QJNIHelper: clean up atomic int and mutex handlingMarc Mutz2017-02-141-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Do not use Q_GLOBAL_STATIC to hold QAtomicInt or QMutex, use file-static QBasicAtomicInt and QBasicMutex instead. They are zero-initialized PODs. 2. Use only QMutexLocker to lock mutexes. Also wrap the atomic counter into a next...() function, as done elsewhere. Change-Id: I4b14ac0de9d4cb6780b1f1372c2b5fc88e918e4c Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| | * Add Q_ASSERT before dereference pointerJesus Fernandez2017-02-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix Null pointer dereferences (NULL_RETURNS) CID 176640: Null pointer dereferences (NULL_RETURNS) Assigning: "p" = null return value from "value". Change-Id: I3af9aae3bbebd6f4de90854ba56cd601669b1b5a Coverity-Id: 176640 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| | * QMutex/Linux: remove unused QBasicAtomicMarc Mutz2017-02-141-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | $ git grep -we futexFlagSupport src/corelib/thread/qmutex_linux.cpp:static QBasicAtomicInt futexFlagSupport = Q_BASIC_ATOMIC_INITIALIZER(-1); The last user of this variable was removed in 9ef59b5. Change-Id: I818a13a481ad25baa5ff7d389a737b8801adcfcc Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>