The usual:
- delete return values of QLayout::takeAt(), replaceWidget()
- delete styles
- delete top-level widgets
- delete actions
Either by naked delete, QScopedPointer or allocation on the
stack instead of the heap.
This fixes the remaining errors in GCC 6.1 Linux ASan runs of
tests/auto/widgets/kernel.
Change-Id: I8cc217be114b2e0edf34ad8d60dbf722f900bb7f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Fixes a regression introduced in commit 51767affb.
QOpenGLContext::globalShareContext requires a QGuiApplication to exist.
This wasn't required so far.
Task-number: QTBUG-56614
Change-Id: I07bcf434fca536c4dc50feee7ea17eb541fd589a
Reviewed-by: Liang Qi <liang.qi@qt.io>
HTTP/2 allows a server to pre-emptively send (or "push") responses (along
with corresponding "promised" requests) to a client in association with a
previous client-initiated request. This can be useful when the server
knows the client will need to have those responses available in order
to fully process the response to the original request.
Server push is semantically equivalent to a server responding to a request;
however, in this case, that request is also sent by the server, as a
PUSH_PROMISE frame.
The PUSH_PROMISE frame includes a header block that contains a complete set
of request header fields that the server attributes to the request.
After sending the PUSH_PROMISE frame, the server can begin delivering the
pushed response as a response on a server-initiated stream that uses the
promised stream identifier.
This patch:
- fixes the HPACK decompression of PUSH_PROMISE frames;
- allows a user to enable PUSH_PROMISE;
- processes and caches pushed data for promised streams;
- updates auto-test - emulates a simple PUSH_PROMISE
scenario.
Change-Id: Ic4850863a5e3895320baac3871a723fc091b4aca
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
isXIEvent() is used iff XCB_USE_XINPUT2 is defined.
So move declaration of the function in XCB_USE_XINPUT2 define scope.
Change-Id: I6f045cd07d572ee7425ee6edc5ac73dcf0afdb37
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
While "commonest" is still correct English, it's rather old-fashioned
and "most common" predominates Qt's wording style.
Change-Id: I20d72c098ee40b2a89f91e42f7208fe5b87286a2
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
All strings coming out of POSIX API calls are converted to composed form
by QFile::decodeName. Do the same for realpath(3) output. This is
especially important for HFS+, which will store file names in decomposed
form, and APIs will therefore return strings in decomposed form.
Task-number: QTBUG-55896
Change-Id: I5e51f4e5712ff26bf9644cbcf9a9603995748892
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
There are more than 1000 new entries since the table has been
generated the last time. The autotest needs to be tweaked
because the rules for the .mz domains have changed; use the
.ck domain instead.
Change-Id: Ife692afd46ac41a66604e966e5e8cb57c7aa649c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Coverity threw an error that in the else branch, the expression
colorTableRGB16[tableSize - 1] accesses uninit'ed data. The working
theory is that it fails to perform the implication
isEmpty() → size() == 0
This patch, therefore, checks for size() == 0 instead of isEmpty(),
which is hardly less readable and might help Coverity understand the
code better.
Then again, Coverity might not understand that the tableSize can never
be negative. If that's the case, another patch will be needed, but
let's try the simpler solution first.
Coverity-Id: 11420
Change-Id: Ibfe2a798c55af95c8001fa909aa94a6c5bc7c647
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
The m_integration member of DeviceIntegration, a naked pointer, was
checked for nullptr in the DeviceIntegration ctor, but never set to
nullptr.
Fix by init'ing it to nullptr in the ctor-init-list.
Coverity-Id: 172056
Change-Id: Ia1dc9b67b9d16a991bba82338eedb19de68f91d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The Qt::ISODate format strips milliseconds, so a new format is introduced
that keeps the milliseconds. A new format was chosen over fixing the
existing format due to the behavioral change of suddenly having ms
as part of Qt::ISODate.
Change-Id: If8b852daed068cce8eee9b61a7cd4576bc763443
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Found by UBSan:
qnetworkreplyhttpimpl.cpp:457:29: runtime error: member call on address 0x602000009cf0 which does not point to an object of type 'QNetworkReplyHttpImpl'
0x602000009cf0: note: object is of type 'QObject'
1e 00 80 18 20 e0 bb 12 54 7f 00 00 00 f2 00 00 70 61 00 00 02 00 00 00 ff ff ff 06 08 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QObject'
#0 0x7f541461b71b in QNetworkReplyHttpImplPrivate::~QNetworkReplyHttpImplPrivate() qnetworkreplyhttpimpl.cpp:457
#1 0x7f541461b7f0 in QNetworkReplyHttpImplPrivate::~QNetworkReplyHttpImplPrivate() qnetworkreplyhttpimpl.cpp:458
#2 0x7f540f26df1a in QScopedPointerDeleter<QObjectData>::cleanup(QObjectData*) qscopedpointer.h:54
#3 0x7f540f26df1a in QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::~QScopedPointer() qscopedpointer.h:101
#4 0x7f540f26df1a in QObject::~QObject() qobject.cpp:940
#5 0x7f540e915f6e in QIODevice::~QIODevice() qiodevice.cpp:416
#6 0x7f5414599bae in QNetworkReply::~QNetworkReply() qnetworkreply.cpp:444
#7 0x7f54145e6f5e in QNetworkReplyHttpImpl::~QNetworkReplyHttpImpl() qnetworkreplyhttpimpl.cpp:239
#8 0x7f54145e6f5e in QNetworkReplyHttpImpl::~QNetworkReplyHttpImpl() qnetworkreplyhttpimpl.cpp:242
#9 0x7f54144b3539 in void qDeleteAll<QList<QNetworkReply*>::const_iterator>(QList<QNetworkReply*>::const_iterator, QList<QNetworkReply*>::const_iterator) qalgorithms.h:317
#10 0x7f54144b3539 in void qDeleteAll<QList<QNetworkReply*> >(QList<QNetworkReply*> const&) qalgorithms.h:325
#11 0x7f54144b3539 in QNetworkAccessManager::~QNetworkAccessManager() qnetworkaccessmanager.cpp:496
Fix by moving the emission of the QNetworkReplyHttpImpl::abortHttpRequest()
signal from ~Private, when the public object is merely a QObject anymore,
to ~QNetworkReplyHttpImpl(), when the public class is still itself.
Change-Id: Ifb3b19f6d180452bdf3fc26f54629ef780a5d9d9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
As the function runs on the XAML thread it can make the app
unresponsive/wait forever on a socket close. Thus we should not wait
forever but have a timeout. If the timeout is hit the socket is not
closed properly but hard reset.
Change-Id: I82e9425c0f8195e3465027fdc2417a93f1c1ad91
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Originally on macOS it would override any tab text color with white
for the active tab as it would set it directly on the option palette
inside the style code. This would cause it to ignore any changes done
by the user in a changed option, via setTabTextColor or in a proxy
style. Therefore the setting of the color should be done when the style
option is initialized and only if the tab text color has not been
set by the user.
This has the added effect of making it easier to change the color for
tabs via a stylesheet since it will not be overridden in the style but
setup correctly in the option instead.
Change-Id: Ic338e96470112cba71d422bce79e664df0cb188a
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
If there is no file path set then it should not be possible to see a
menu or to drag from a proxy icon in the titlebar.
Task-number: QTBUG-56082
Change-Id: Ib8305bcab5717bc8cb7ddabbb079f152debbdded
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
When an image is considered to be monochrome then it should not be
making the white part of the image transparent, the colors should be
kept as is.
Task-number: QTBUG-56489
Change-Id: I3621ca7be2a0ebe6852363f860c0b3de28d28a31
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
With the client message _NET_ACTIVE_WINDOW, not all window managers
will pass focus from a child window to its root window, Detect this
child-to-root case, and use xcb_set_input_focus() instead.
Task-number: QTBUG-39362
Change-Id: Ib32193018e3b725b323f87d7306c9ae9493d78a7
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This is an improvement for the following reasons:
- Should mutex locking allocate any kind of resource,
unlocking in reverse order will free those resources
in inverse order, which helps typical allocators.
- If the lock pair is contended, by unlocking in the
same order as locking, we were allowing the waiting
thread to wake up to take the first lock just to
find that the second lock is still held by someone
else.
The order of unlocking has no influence on the correct-
ness of the algorithm.
Change-Id: Id16b0342aef325c14a7bd8836d3a75db68ef2588
Reviewed-by: David Faure <david.faure@kdab.com>
The current wording (reference) seems like it's always a pointer to valid stuff
Change-Id: I2a9f8bde7d2ba672e4e664ff731a3272a6deaaaa
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Change 0696566b1e caused the block
size to be incorrect for data > 32MB.
Since bytesToWrite changes within the do...while loop, then the block size
can potentially change too each time. So it needs to be recalculated each
time rather than just once.
Task-number: QTBUG-56616
Change-Id: I9880d0985f2d0242c30e67230be7271eb806db95
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
QBenchmarkTimeMeasurer uses the 3rd party header cycle_p.h which may
include windows.h on Windows (32bit). This can cause clashes in qmltest,
which uses QBenchmarkMeasurerBase. Move the derived classes to a separate
header to prevent this.
Change-Id: I943a11c32a575594e6e79e722e8809b42de35092
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Prefer QStringRef methods to avoid allocations.
Use startsWith/endsWith rather than comparing substrings;
and avoid substrings where references suffice.
Use new QStringList::join(QL1S).
Change-Id: I46c44aca96578633370006d613eb0ac13f7cfc03
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use QStringBuilder more.
Avoid quadratic behavior when prepending zeros
in a loop, prepend whole string intead.
Use const API more for CoW types.
Change-Id: If114107dc3d9876b9a7c77bc0071878cb6e00892
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
By templating on the <chrono> types and unconditionally using
duration_cast to coerce the duration into a milliseconds, we
violate a principal design rule of <chrono>, namely that non-
narrowing conversions are implicit, but narrowing conversions
need duration_cast. By accepting any duration, we allow non-
sensical code such as
QTimer::singleShot(10us, ...)
to compile, which is misleading, since it's actually a zero-
timeout timer.
Overloading a non-template with a template also has adverse
effects: it breaks qOverload().
Fix by replacing the function templates with functions that
just take std::chrono::milliseconds. This way, benign code
such as
QTimer::singleShot(10s, ...)
QTimer::singleShot(10min, ...)
QTimer::singleShot(1h, ...)
work as expected, but attempts to use sub-millisecond
resolution fails to compile / needs an explicit user-
provided duration_cast.
To allow future extension to more precise timers, forcibly
inline the functions, so they don't partake in the ABI of the
class and we can later support sub-millisecond resolution by
simply taking micro- or nano- instead of milliseconds.
Change-Id: I12c9a98bdabefcd8ec18a9eb09f87ad908d889de
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Saving strings with embedded zero-bytes (\0) as CFStrings would
sometimes fail, and only write the part of the string leading
up to the first zero-byte, instead of all the way to the final
zero-terminator. This bug was revealed by the code-path that
falls back to storing e.g. QTime as strings, via the helper
method QSettingsPrivate::variantToString().
We now use the same approach as on platforms such as Windows
and WinRT, where the string produced by variantToString() is
checked for null-bytes, and if so, stored using a binary
representation instead of as a string. For our case that
means we fall back to CFData when detecting the null-byte.
To separate strings from regular byte arrays, new logic has
been added to variantToString() that wraps the null-byte
strings in @String(). That way we can implement a fast-path
when converting back from CFData, that doesn't go via the
slow and lossy conversion via UTF8, and the resulting QVariant
will be of type QVariant::ByteArray. The reason for using
UTF-8 as the binary representation of the string is that
in the case of storing a QByteArray("@foo") we need to
still be able to convert it back to the same byte array,
which doesn't work if the on-disk format is UTF-16.
Task-number: QTBUG-56124
Change-Id: Iab2f71cf96cf3225de48dc5e71870d74b6dde1e8
Cherry-picked: 764f5bf48c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
For SP_TitleBarMenuButton, the style defaulted to standardPixmap()
would return a 16x16 XPM encoded pixmap from qcommonstylepixmaps_p.h.
This resulted in a too-small menu icon when displaying QMdiSubWindow
with the default icon set on a High DPI screen with
Qt::AA_DisableHighDpiScaling set.
Add a larger icon from resources.
Change-Id: If88c606a31ee9499f520089365f685ec75e0ddad
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Comparing pointers that do not point into the same array using
operator< is UB. You need to use std::less<>.
The QOrderedMutexLocker ctor already used std::less to compare
pointers, but the static relock() function was not fixed.
Amends 5007352164.
Change-Id: I584d382391dd5a2af75020a4e77f3e42ee5d5708
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Don't use C++11 nullptr in 5.6.
Change-Id: I57e9595b2e1cede995eed09878bf02ee30482659
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Alberto Mardegan <mardy@users.sourceforge.net>
all users of this functionality have been removed, and not emitting the
version info saves quite some noise from the generated files.
the reason why the users have been removed is that it was unreliable in
the first place: if a dependency is found without pkg-config, no version
information would be available.
the extraction of the version via pkg-config itself is kept in place, as
configure tests could be potentially optimized by utilizing it.
this reverts much of commit 48b4e0bf6f.
Change-Id: I01917f3b2a56b747d7cc54955141d20d23d0990a
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Otherwise, those tools do not compile in configurations which exclude
features that these tools require (e.g., -no-feature-textcodec).
Change-Id: I9f27257221755a35a48ae2efa9df63f1a319118e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
At certain sizes and scales, GDI will clip away the bottom line
of pixels when rendering the MingLiU fonts. Since DirectWrite
renders it correctly, we force the use of DirectWrite in this case.
This also requires supporting classic GDI rendering in the DirectWrite
engine, to make sure the rendering still looks correct.
Note that this does not cover the corner case where the font is loaded
directly from data with QRawFont.
[ChangeLog][QtGui][Windows] Fixed rendering error when using the
MingLiU fonts at certain combinations of pixel size and scale.
Task-number: QTBUG-49346
Change-Id: Ie026c0d5932717858c4536dae077013eb6a1eafc
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
QTPLUGIN.<foo> is better used with valid variable names, which is not
the case when the plugin type contains slashes (plugin subtypes) or
dashes (just so). normalize these chars to underscores.
Change-Id: Icc93d952b93fef342e2fc93f20e9c5dd010dd734
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
this code is meant to strip off the file name if provided (as the
accessibility plugin in qtdeclarative does), but clearly overshot the
mark by stripping the subtypes (as needed by qtmultimedia, and soon
qtbase as well). use a stricter regexp which matches only names with an
extension, which is a Good Enough (TM) approximation.
Change-Id: I63afe9c7b1b0ebf4da530dcf558e9c84ae3c85ec
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Do not set WindowsContextHelpButtonHint directly in Windows QPA plugin,
but instead rely on logic in QWidgetPrivate::adjustFlags for widgets.
If WindowsContextHelpButtonHint is set, a '?' button is shown in the
windows decoration. If pressed, an EnterWhatsThisMode event is generated
that is consumed in QApplication that then calls into the QWhatsThis
singleton, which changes the mouse cursor, and informs the top-level
QWidgets about the state change etc.
For QGuiApplications though the event is not generated, which makes the
button useless by default. In addition, QWhatsThis only works with top
level QWidgets, not e.g. QQuickWindows. So for apps using QApplication
and QtQuick.Controls this means that the "What's this mode" is never
exited.
Given that the paradigm is somewhat outdated on the desktop it is unlikely
that Qt Quick Controls will implement support for What's this. Anyhow,
QWidgetPrivate::adjustFlags sets the hint for Qt::Dialogs, too,
so there's no need to set it the Windows QPA plugin.
[ChangeLog][Windows] 'What's this' button is now shown by default
only for QWidget dialogs.
Task-number: QTBUG-56239
Change-Id: I1ea3e92ade723b5865c8f2e19674413433658942
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
There's a conflict between QGtk3Menu and QDbusPlatformMenuBar. The
problem is that on Unity the type of the platform menu instance must
be different depending on whether the menu is in the global menubar or
a standalone context menu.
Since QMenu creates a platform menu instance at construction time, it
does not yet know whether it will be added into a menubar. QMenuBar
checks that the QMenu already has a platform menu instance, and passes
it to the platform menubar. As a result, a QGtk3Menu instance is passed
to QDbusPlatformMenuBar.
Currently, a standalone QMenu does not use the native platform menu
instance. Only menus that are added to a QMenuBar do. Therefore we
don't need to create the platform instance when QMenu is constructed,
but only after it is added to QMenuBar. The platform menu instance
creation is implemented in QMenuBarPrivate::getPlatformMenu(), and
QMenu::setPlatformMenu() calls syncPlatformMenu() to take care of
syncing the QMenu properties and actions to the new platform menu
instance.
The macOS-specific methods QMenu::toNSMenu() and QMenu::setAsDockMenu()
rely on the platform menu instance, and must therefore create it on
demand.
This is a hot fix for the release blocker, not a long term solution.
In the future, if standalone QMenus are made to use native platform
menu instances, the instance must be created lazily when the menu is
about to be made visible.
Task-number: QTBUG-56526
Change-Id: I044933cabb1639406fe47908dfc4b1903af214d1
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>