Commit Graph

35636 Commits

Author SHA1 Message Date
Christian Ehrlicher
acc629c1e8 Examples: replace QDesktopWidget::availableGeometry()/screenGeometry()
QDesktopWidget::availableGeometry()/screenGeometry() was deprecated in
5.11 and replaced with QScreen::availableGeometry()/screenGeometry()

Change-Id: I912a133971c41196f8f49754c28ce92711ff42bb
Reviewed-by: Martin Smith <martin.smith@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2018-03-27 16:50:05 +00:00
Christian Ehrlicher
10db31f933 Examples: replace QDate::longMonthName()/longDayName()
QDate::longMonthName()/longDayName was deprecated in 5.10 and replaced
by QLocale::system().monthName()/dayName() in this case

Change-Id: I666cccfa1b8a437cc830804bbe3504511265ea9b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-03-27 16:50:01 +00:00
Christian Ehrlicher
1c33e8945d Examples: replace deprecated QQuaternion::conjugate()
QQuaternion::conjugate() was deprecated with 5.5 and replaced by
QQuaternion::conjugated().

Change-Id: I0176e3db82e9ad793f60e1034a22b11832c8c44d
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
2018-03-27 16:49:58 +00:00
Alexander Volkov
c7ac077128 Doc: Fix description of QStyleOptionMenuItem::tabWidth
It is actually not the tab width but the width reserved
for the menu item's shortcut.

Change-Id: I801dff0c57256690f61c022156a80cf6ff530c43
Reviewed-by: Martin Smith <martin.smith@qt.io>
2018-03-27 16:16:38 +00:00
Alex Trotsenko
cdbd68fc2f Allow QWinEventNotifier to coexist with waiting functions
Many subclasses of QIODevice have a functionality to block execution
until some asynchronous I/O operation completes. In case we are using
QWinEventNotifier, a typical reimplemented waitFor{ReadyRead
|BytesWritten}() function could look like:

  if (WaitForSingleObject(notifier.handle(),...) == WAIT_OBJECT_0) {
      notifier.setEnabled(false);
      ResetEvent(notifier.handle());

      bool res = GetOverlappedResult(...);
      ...
      return true;
  }

Despite the fact that the operation ends synchronously, it leaves the
notifier in a state that indicates it has received the event, so its
next call to setEnabled(true) will produce a fake notification.

So, we should reset a notifier's history before enabling it again.

Change-Id: I62a9dd809ce6a7a40e9d8038f2a49299b36f8142
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2018-03-27 15:08:46 +00:00
Albert Astals Cid
09f3b19f98 cups: Honor installable options for Duplex
i.e. don't show the duplex options if you don't have the duplexer
hardware installed, otherwise you just get a conflict warning
selecting any duplex option which doesn't make any sense since it's
not something you can fix by other means than going out and
buying the missing hardware

Change-Id: Ief3fea5b86ab65b18765887b1c5d6d279ee337fa
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2018-03-27 12:02:37 +00:00
Albert Astals Cid
0fb3d21778 cups: Take conflicts for duplex and page size into account
Duplex and Page Size are not shown in the "Advanced" options tag
since they are more important options, this means we were not
taking them into account for ppd conflicts since we never set
their values in the ppd, we do use the new-style cups options for
them when printing

With this patch we add m_pageSizePpdOption and m_duplexPpdOption
to set the values to the ppd struct behind the scenes.

Change-Id: I48bd9fe93d0c08b7b8dd9620a07c56fc79cce13b
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2018-03-27 12:02:26 +00:00
Filipe Azevedo
3d5fd088c3 Fix build issue on macOS
Change-Id: Ib3aa37242e9bf66c3fc3d232ead1e6ef4d4bc485
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2018-03-26 14:48:59 +00:00
Jesus Fernandez
0dd326ea7a Initialize m_cupsCodec
Ensure initialization of m_cupsCodec to nullptr. The codec is checking
the value of m_cupsCodec; but the initialization was conditional before
this patch.

Change-Id: I81751b7743e9956f31f17cead01dc05e268db7eb
Coverity-Id: 188700
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-03-26 14:44:03 +00:00
Morten Johan Sørvig
ed4833465b Cocoa: Deliver window activation events synchronously
This prevents delivering queued activation events
to windows that have been hidden or destroyed.

Task-number: QTBUG-66536
Change-Id: I4edf86b6c8592751130f836876725c786452933c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2018-03-26 07:23:16 +00:00
Sergio Martins
a6d1456458 Add QTimer::connectTo(), a shorthand way of connecting to timeout()
There are a couple of Qt classes where you almost always use the
same signal, for example QTimer::timeout, QPushButton::clicked,
and QAction::triggered.

Simply doing timer.connectTo([]{}) is much more convenient, less
tedious and even fun.

Not overloading connect() as it would be confusing to see the
receiver as first argument.

And not naming it onTimeout, as that's a popular way of doing it in
other frameworks. People would assume you could use on* with any signal.
If we ever have on* it should be all or nothing.

[ChangeLog][QtCore] Added QTimer::connectTo(), a shorthand way of
connecting to the timeout() signal.

Change-Id: Ida57e5442b13d50972ed585c3ea7be07e3d8e8d2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2018-03-25 21:17:20 +00:00
Alexander Volkov
863c688749 Update READMEs for the bundled xcb sources and the xcb plugin
Mention that the current minimal supported version of
libxcb is 1.9.1, amend 1f5d791708.

Remove the specific package requirements for the xcb plugin:
these lists are unmaintained and besides there are build
instructions in wiki: https://wiki.qt.io/Building_Qt_5_from_Git

Change-Id: I4d5b0583a1ba8a355ee1649022845f6c8d520e7c
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-03-23 19:01:25 +00:00
Mårten Nordheim
a7dda3e4b0 Move QWindowsCaRootFetcher to its own file
In preparation for its usage in QDtls.

Change-Id: I7b28ac060e350228839461dc027c809af9ff73a4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-03-23 18:14:59 +00:00
Christian Ehrlicher
89bf58b070 Benchmark/QImageReader: remove unused dependencies
QImagereader benchmark does neither depend on network nor widgets.
Therefore those two dependencies can be removed here.

Change-Id: Ic127b2668e22608774ce5878454f4a96ef591f6b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2018-03-23 17:42:52 +00:00
Shawn Rutledge
c08bf215cc Add a legacy-free QWheelEvent constructor
qt4Delta and qt4Orientation have been "deprecated" ever since Qt 5.0
(even though widgets continue to depend on those properties).  This
is mainly for use in Qt Quick right now, but can be used everywhere
later on.

Change-Id: If0b163766c8ad8efa268edaa4f1ac1e8926f9003
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2018-03-23 17:28:17 +00:00
Albert Astals Cid
e8260edf87 Unify QPlatformPrintDevice constructors
Change-Id: I01714a626e204c73456ebed987055662331d6a3a
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-03-23 15:53:40 +00:00
Albert Astals Cid
c0a7c7b42d Remove unused QPpdPrintDevice constructor
Change-Id: I19a6cddebfbd1b72f01feae8873a634348cdc926
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-03-23 15:53:36 +00:00
BogDan Vatra
5daaafa084 Update gradle files
Change-Id: I7324082ef9eb19cb0851a0a53e8e41ee8f174210
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2018-03-23 10:30:52 +00:00
Harald Nordgren
97e40a5409 Allow adaptive decimal stepping for QSpinBox and QDoubleSpinBox
Adds the feature of adaptive decimal step sizes for the QSpinBox and
QDoubleSpinBox. By performing a calculation in
QAbstractSpinBox::stepBy() we continuously set the step size one power
of ten below the current value.

So when the value is 1100, the step is set to 100, so stepping up once
increases it to 1200. For 1200 stepping up takes it to 1300. For
negative values stepping down from -1100 goes to -1200.

It also works for all decimal values. 0.041 is increased to 0.042 by
stepping once, and so on.

The step direction is taken into account to handle edges cases, so that
stepping down from 100 takes the value to 99 instead of 90. Thus, a
step up followed by a step down -- or vice versa -- lands on the
starting value; 99 -> 100 -> 99.

Setting this property effectively disregards singleStep, but preserves
its value so that it takes effect again when adaptive decimal step is
disabled.

Adaptive decimal step allows values to be easily set to reasonable
levels. If the spin box value is 12000, changing to 13000 often makes
more sense than to 12001. The feature is turned off be default, when
single stepping is desired.

The accelerated property allows values to be changed quickly, as well,
but it is imprecise. Holding down the button makes it hard to land on
an even thousand, like 12000 or 13000. Often you end up somewhere
nearby and would need a second adjustment to get to an even hundred or
thousand.

[ChangeLog][QtWidgets] Add option of adaptive decimal step size for
QSpinBox and QDoubleSpinBox.

Change-Id: I9f286479b821e240c8ea05c238932fc128c582bb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2018-03-22 21:37:45 +00:00
Alexander Volkov
a692d7cd28 xcb: Use XCB instead of Xlib for XInput
- Replace xinput2 feature by xcb-xinput, which doesn't
  depend on xcb-xlib
- Remove xi2PrepareXIGenericDeviceEvent() that was used to
  fix incompatibilty between XCB and libXi structs
- Drop XCB_USE_XINPUT21 and XCB_USE_XINPUT22 defines that were
  needed with libXi

Although xcb-xinput was released in version 1.13 of libxcb,
it was quite stable in version 1.12, and the parts that we
use did not change between versions, so require system
xcb-xinput 1.12.

[ChangeLog][X11] The xcb plugin was ported to use libxcb-xinput
instead of libXi for XInput2 support. The -xinput2 configure
option was replaced by -xcb-xinput.

Task-number: QTBUG-39624
Change-Id: I37475b09b2bd7057763345c3f33d8c7751a4e831
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-03-22 20:51:09 +00:00
Allan Sandfeld Jensen
8b16557c35 Avoid destStore64 when pixels are just repeating
The destStore64 operation can be expensive, so when the pixels are just
repeating, avoid using it and the composition, and just repeat the
first generated part.

Change-Id: I6e21594a9abecdc245010b956acbaa60e3fb21a3
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2018-03-22 20:03:52 +00:00
Morten Johan Sørvig
8efacb9d1e Cocoa: Remove m_viewIsEmbedded and m_ViewIsToBeEmbedded
Implement QCocoaWindow::isEmbedded() which detects this
property based on parent view and window type. This avoids
having to use a setter function to set the state.

The detection can’t handle all cases, but should be
sufficient for our use case.

Change-Id: I12a5b90b4e4a7e10714f7275ae001e99c9361e2c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2018-03-21 11:33:22 +00:00
Qt Forward Merge Bot
cc920b4cdd Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I35a6555e3885e489f88aa9b4b0142e1017f7a959
2018-03-21 08:59:26 +01:00
Tor Arne Vestbø
c8c8cc790a macOS: Make [QNSView wantsLayer] declarative
Change-Id: Ib5dc8178293d13542a54d51484181debd57580f5
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2018-03-21 02:03:12 +00:00
Sergio Martins
fc8fd50816 Fix subpixel rendering on Windows/FreeType
FT_LCD_FILTER_H wasn't defined because we weren't including the header.
To fix it just remove the checks, as was done for Linux and assume
sub-pixel is there. If it's not then no harm done, it won't use any.

Change-Id: I76f50cb17e41621c45c03cb7d5c75c110557ea68
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-03-20 21:16:22 +00:00
Alexander Volkov
62f053c19b Add xcb-xinput to 3rd party libs
The added xcb-xinput code was produced by build of libxcb 1.13
with xcb-proto 1.13.
The following parts were removed from it:
 - Pointer Barriers API (requires xcb-xfixes 1.9 with xcb-proto 1.9)
 - SendExtensionEvent API (requires definition of xcb_raw_generic_event_t
   from libxcb 1.13)

[ChangeLog][Third-Party Code] Sources of xcb-xinput 1.13 were bundled and
are available via -qt-xcb.

Change-Id: I43d2f43bee0ba874d099c9fb858e74b0e3edc970
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-03-20 20:49:44 +00:00
Alexander Volkov
1f5d791708 Bump up the required libxcb version to 1.9
...and update bundled xcb sources to libxcb 1.9.1 with xcb-proto 1.8.
These are the minimal versions of libxcb and xcb-proto available
on officially supported platforms (they are present on RHEL 6.6).

Remove support_libxcb_versions_where_xcb_sumof_not_available.patch
and revert it for xkb.c, because libxcb 1.9 implements xcb_sumof().

This change makes it easier to bundle xcb libs from newer versions
of libxcb (e.g. xcb-xinput).

[ChangeLog][Third-Party Code][X11] The minimal required version of
libxcb is now 1.9. Bundled xcb sources were updated to libxcb 1.9.1
built with xcb-proto 1.8.

Change-Id: Iebcd05656c4a5ed5dd95e898d497acef857423f0
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-03-20 20:49:33 +00:00
Allan Sandfeld Jensen
7ebe69d23c Expose gdb-index as configure argument
We report it in the overview, but left no way of controlling it

Change-Id: I1d31f2e31bb32566f47069c3776e41033ffb1891
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-03-20 20:45:21 +00:00
Tor Arne Vestbø
321c2d29fb macOS: Provide helper property for resolving the display ID of a screen
Change-Id: I144bd33a2c122d53ea1435a53483a3d8b46fd093
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2018-03-20 19:43:36 +00:00
Tor Arne Vestbø
ffc20153d1 macOS: Remove stray qDebug in [QNSView setNeedsDisplayInRect:]
Change-Id: Ia253edf84bc0c890f291499ed2635d8287b18327
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2018-03-20 19:43:36 +00:00
Tor Arne Vestbø
9c17b8adb9 Update rasterwindow example to not render in resizeEvent
The resize event should not be used to draw, as there will be a follow-up
exposeEvent delivered just after, and we don't want to draw twice.

This is how QRasterWindow operates too, except it defers the backingstore
resize to beginPaint() instead of resizing in the reizeEvent.

It's also how QOpenGLWindow operates, which also has a note for the
virtual resizeGL method saying: "Scheduling updates from here is not
necessary. The windowing systems will send expose events that trigger
an update automatically."

Change-Id: I2a9740018508c2eb129149f53237ee8e378c03b1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-03-20 16:00:31 +00:00
Tor Arne Vestbø
ea60b4eb9a Clarify that QExposeEvent/exposeEvent handles any invalidation of the window
Change-Id: Ib6f649213e3268c6946c7fa973ce970e896a46a0
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2018-03-20 14:35:10 +00:00
Tor Arne Vestbø
941aea658f macOS: Do layer updates via the CALayerDelegate protocol
The updateLayer function is only called when the layer is a
_NSViewBackingLayer instance, which is what the default
implementation of [NSView makeBackingLayer] returns.

Once we move to optionally returning a CAMetalLayer, we need
to use the more generic displayLayer: API, so we do that now
as a first step.

This matches the way we draw and send expose events on iOS.

Change-Id: I49721ff005ca9dfddebff645705f96b5ab46abb4
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-03-20 12:56:57 +00:00
Tor Arne Vestbø
9b604a151a macOS: Move QNSView drawing related functionality to its own file
Change-Id: Iaeaa5c57368445a1fd67d110823c919aa7173a7a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-03-20 12:56:47 +00:00
Allan Sandfeld Jensen
a65e383cac Switch lancelot from QRegExp to QRegularExpressions
They are faster, and using them makes it paint commands be the most
CPU intensive part of lancelot instead of regular-expression matching.

Change-Id: Ifabf1081c48a83ce089660049051428fd3a43042
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2018-03-20 09:00:14 +00:00
Ulf Hermann
5a4787dca0 Modernize the "regularexpression" feature
Use QT_CONFIG(regularexpression), disentangle it from QT_BOOTSTRAPPED,
switch it off in the bootstrap build, remove the #ifdefs from
qregularexpression.{h|cpp}, and add QT_REQUIRE_CONFIG(regularexpression)
to the header.

qregularexpression.{h|cpp} are already correctly excluded in tools.pri
if !qtConfig(regularexpression).

Change-Id: I21de154a6a118b76f99003d3acb72ac1e220d302
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-03-20 08:19:25 +00:00
Ulf Hermann
dd74f5d347 Gui: Properly use the standarditemmodel feature
Require it in the headers and exclude the implementation from the build
if disabled.

Change-Id: Ida3303f8595f47b469e92d68e8bccc3957d943b6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-03-20 08:19:03 +00:00
Lars Knoll
bbdc1b5ccb Share and cache QRegExp engines where possible
QRegExpEngine is immutable once created, so we can easily share
them between different QRegExp instances. This requires a QHash for
engines that are currently in use in addition to the cache for
currently unused engines.

Task-number: QTBUG-65710
Change-Id: I165c12a7b065c488ecd14258a7cdfe0e62666632
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-03-20 07:54:01 +00:00
Lars Knoll
f4b6ea2ae2 Fix infinite recursion on stack trying load empty glyhs
Loading empty glyphs in some fonts would cause the application
to crash with an infinite recusion on the stack between qfontengine
and qfontengine_ft:

12 0x00007ffff6954395 in QFontEngine::alphaMapForGlyph (this=0x7fb0c0, glyph=50, subPixelPosition=..., t=...) at text/qfontengine.cpp:877
13 0x00007fffee7d104e in QFontEngineFT::alphaMapForGlyph (this=0x7fb0c0, g=50, subPixelPosition=..., t=...) at freetype/qfontengine_ft.cpp:2096
14 0x00007fffee7d0ea8 in QFontEngineFT::alphaMapForGlyph (this=0x7fb0c0, g=50, subPixelPosition=...) at freetype/qfontengine_ft.cpp:2078
15 0x00007ffff6954395 in QFontEngine::alphaMapForGlyph (this=0x7fb0c0, glyph=50, subPixelPosition=..., t=...) at text/qfontengine.cpp:877
16 0x00007fffee7d104e in QFontEngineFT::alphaMapForGlyph (this=0x7fb0c0, g=50, subPixelPosition=..., t=...) at freetype/qfontengine_ft.cpp:2096
17 0x00007fffee7d0ea8 in QFontEngineFT::alphaMapForGlyph (this=0x7fb0c0, g=50, subPixelPosition=...) at freetype/qfontengine_ft.cpp:2078
18 0x00007ffff6954395 in QFontEngine::alphaMapForGlyph (this=0x7fb0c0, glyph=50, subPixelPosition=..., t=...) at text/qfontengine.cpp:877
...

Fix this by trusting the freetype fontengine that it could load the glyph,
as the base class anyway can't do better.

Task-number: QTBUG-62331
Task-number: QTBUG-66617
Change-Id: I6c7c24d24ec0f71a66fa519c04a336f276e418f6
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2018-03-20 07:53:09 +00:00
Lars Knoll
83c01a5909 Fix display recognition for IBUS
The parsing of the DISPLAY environment variable was wrong,
and only worked by accident for DISPLAY=':[0-9]'.

Task-number: QTBUG-62068
Change-Id: I6860e3907c9b1ad6e538d1b5d08628cd306b4aa1
Reviewed-by: Alexander Volkov <a.volkov@rusbitech.ru>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2018-03-20 07:52:52 +00:00
Mikhail Svetkin
91a52fc6a0 widgets: Add a QT_CONFIG(style_stylesheet) guard
for isWindowsStyle in QDockWidget

Change-Id: Id471b91a415f1a677ced6022bdd05b7e1b72aad2
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2018-03-20 07:51:36 +00:00
Simon Hausmann
0ffb7c419a Fix CONFIG+=qtquickcompiler and immediate resources with shadow builds
Generated files should be added to RESOURCES with an absolute path.

Task-number: QTBUG-67011
Change-Id: Ief82b576824df9abd0901970f076e30dfe57b7d0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-03-20 07:34:50 +00:00
Timur Pocheptsov
04f3534815 Make getErrorsFromOpenSSL thread-safe
If we pass nullptr as a buffer parameter, ERR_error_string uses
a local array with static storage duration, which makes ERR_error_string
non thread-safe. Instead we can use ERR_error_string_n with our
own buffer. As for the size: docs are inconsistent, sometimes
they say 'at least 120 bytes long', sometimes 'at least 256 ...'.
Their code (ERR_error_string implenented via call to ERR_error_string_n)
has buf[256] and so we do. I know this will enrage our Mr. Bot, but I've
removed a stray whitespace.

Change-Id: I4b8cc7b6b9af1a34fc87a760927a493332cdd0a5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-03-20 05:10:06 +00:00
Friedemann Kleint
1cb439dc94 Windows QPA: Fix potential crash in leave event handling
Add a check for window != nullptr.
Amends af5c8d04fb.

Task-number: QTBUG-67101
Task-number: QTBUG-57864
Change-Id: I2bbbbe514fc494fd569d0932d508c53c0544f665
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2018-03-20 00:36:20 +00:00
Thiago Macieira
323b00e38c QSharedDataPointer: use swap-and-move in the move constructor
This makes the pointer that was in the moved-into object be destroyed
before the return of this function (if the reference count was 1),
instead of letting it live in the moved-from object.

Task-number: QTBUG-66322
Change-Id: I3debfc11127e4516b505fffd151209292bd3adaa
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-03-19 20:36:59 +00:00
Thiago Macieira
dabc76de80 QSemaphore: add minor optimization for 64-bit Linux systems
Since we won't use the high bit of the low 32-bit word at all, we don't
need the AND with 0x7fffffff either. Just cast.

Change-Id: I72f5230ad59948f784eafffd151aa5a7dee995db
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2018-03-19 20:36:55 +00:00
Thiago Macieira
081c001deb QSemaphore: fix deadlock when the woken up thread wakes up another
When the thread that got woken up by release() is supposed to release()
to wake up another thread, we were deadlocking. This happened because we
cleared the bit indicating that there was contention when the first
release(). Instead of storing a single bit, we now store the number of
threads waiting.

Task-number: QTBUG-66875
Change-Id: I72f5230ad59948f784eafffd15193873502ecba4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-03-19 20:36:51 +00:00
Thiago Macieira
9fa2626ef8 Remove src/corelib/arch, merging with src/corelib/thread
There is no more architecture-specific code.

Change-Id: Ie9d9215342d449c48a11fffd151d11411cd73fc7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-03-19 20:36:45 +00:00
Thiago Macieira
90493e16b8 Atomics: remove qatomic_msvc.h
No longer needed. The comment about missing constexpr support is
incorrect: MSVC 2015 does have constexpr issues, but they don't affect
our use of std::atomic.

Change-Id: Ie9d9215342d449c48a11fffd151d11208137f00d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-03-19 20:36:41 +00:00
Thiago Macieira
38597dd080 Atomic: silence MSVC warning in the generic fetchAndSub
MSVC atomics still use the generic version, instead of qatomic_cxx11.h.
The implementation of fetchAndSub is implemented on top of fetchAndAdd,
but produced a warning with unsigned types.

Change-Id: I72f5230ad59948f784eafffd151aa53435b75298
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-03-19 20:36:36 +00:00