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>
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>
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>
the order of the arguments passed to addExclusiveBuilds() determines the
name of the CONFIG flag which actually enables the mode. that is
historically fixed to iphonesimulator_and_iphoneos and we cannot just
change the order.
to get around this, add a new "overload" of the function which allows
specifying the flag independently from the order of the builds, and make
use of it in ios' resolve_config.prf.
amends d2b4a789c.
Change-Id: Ia3fabea0c0c30beae680b57e75bdcdf35ef6503d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
5971b88ecd introduced a regular expression
to parse the Visual C++ compiler version that failed to match non-English
output (e.g. German), which is produced by default on many systems.
Task-number: QTBUG-56388
Change-Id: Id0408ce31e827e7aa087d8e3dd83024cf09dac23
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Fixes build with the latest GCC 7.
Change-Id: I4900a256ed1c6cb177d7f94d54e5b07c06ddad08
Task-number: QTBUG-56514
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
When setting the editable property to false, we delete the internal
QLineEdit used by QComboBox. Add comments that this results in the loss
of validator and completer.
Task-number: QTBUG-56035
Change-Id: Ife04ac2b9bb3f32fae5328f1ec73b1d5d769d52c
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
Reviewed-by: Nico Vertriest <nico.vertriest@theqtcompany.com>
Previously when a new QOpenGLFramebufferObject was bound, the
QOpenGLContextPrivate::qgl_current_fbo member was also updated to point
to this new object.
But if a user called QOpenGLFramebufferObject::bindDefault(),
qgl_current_fbo was not unset, meaning that if the FBO object would be
deleted at some point, qgl_current_fbo would be a dangling pointer.
This patch makes sure to clear the value of qgl_current_fbo when
bindDefault() is called. It is cleared, and not set to point to another
object because the default platform OpenGL FBO is not backed by a
QOpenGLFramebufferObject.
Task-number: QTBUG-56296
Change-Id: I68b53d8b446660accdf5841df3d168ee2f133a90
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
If a global shared context is created, and afterwards a new default
QSurfaceFormat with a different version or profile is set, it can
lead to issues with context sharing.
The documentation for QSurfaceFormat::setDefaultFormat mentions
this. It would be helpful to actually show a warning in case it
happens.
Change-Id: I71f7ce95496e1ecbfc6a0c7d7bed146ef8dc351e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Depending on #include order isn't a good idea.
Change-Id: Ief935e1fcc5d40ecb510fffd147c08dffe6cba2d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Clip the transformed and rounded sourceClip to the source rectangle,
so we don't try to rotate pixels outside the source.
Task-number: QTBUG-56252
Change-Id: Ib9cb80f9856724118867aea37ead0b02a6c71495
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
It was introduced in Qt 4 by the commit
13a31fe82845f8b1f4d86919080d3b2a87c4d061 and was unused
even there.
Change-Id: I5f3861918ea1f443f7e13439fafa067f2b28a91a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Offscreen windows should not be handle by the platform plugin.
Task-number: QTBUG-50973
Change-Id: I719a24b9bbcaad460d78fdc4095e86d615357cd2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
QWindows that aren't created, and therefore don't have a platform window
attached, should not be treated as "normal" windows. The expectation,
in our code, is that these windows won't get their geometry updated by
the platform plugin, and that the geometry is only changed by the owner.
In QQuickWidget's case this was causing the scene to be rendered
incorrectly.
Task-number: QTBUG-50973
Change-Id: Iea62dfb7fa90cbe450a662c5792c7c4f49c991fd
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
When shmget() failed, we didn't set m_shm_info.shmid (not even to the
-1 failure id) but did pass it (i.e. uninitialized noise) to shmat(),
among other related functions. Guard against this; handle failure
gracefully.
Task-number: QTBUG-56419
Change-Id: Ie823c36c2ede03af6cb5d94ce7b4b5cd543c1008
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Joni Poikelin <joni.poikelin@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
A fall-through here is logically non-sensical, because of symmetry (or
lack thereof). Thus, a break must have been intended.
Add it.
While we're at it, also replace the default case label with the
non-functional enum value QInternal::DockCount, so that -Wswitch can
warn us if ever there should be a new DockPosition.
Found independently by both GCC 7 and Coverity.
Coverity-Id: 11145
Coverity-Id: 11146
Coverity-Id: 11147
Change-Id: I6bb31c1517e40f0cb06ceaee5aeb6fa78b84a523
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
It is already blacklisted for 10.8 and 10.9, and is now failing on 10.11
blocking integration.
Change-Id: I71b8119ab32ec64096bfc53d5e521714ad4ae11b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
GCC 7 warns about implicit fall-throughs now.
Fix by adding the missing comment.
Didn't send a patch to upstream, because upstream harfbuzz-old hasn't
seen a commit in four years, and this code is no longer in harfbuzz-ng.
Change-Id: Ic97efbe01edd37738dcdf43528e82511197d7fb2
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
GCC 7 warns about implicit fall-throughs now.
Fix by adding the missing comments.
Change-Id: I081d4db07c7f2b30ee6344a166aaec34ac639ee5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Found by UBSan:
tst_qwidget.cpp:10207:29: runtime error: member access within address 0x6060000e8880 which does not point to an object of type 'EnterTestModalDialog'
0x6060000e8880: note: object is of type 'QWidget'
eb 00 80 45 10 4b 32 ab 11 2b 00 00 80 df 08 00 60 61 00 00 c0 4c 32 ab 11 2b 00 00 00 00 be be
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QWidget'
#0 0x6ca13f in EnterTestMainDialog::eventFilter(QObject*, QEvent*) tst_qwidget.cpp:10207
#1 0x2b11b8bc90c3 in QCoreApplicationPrivate::sendThroughApplicationEventFilters(QObject*, QEvent*) qcoreapplication.cpp:1081
#2 0x2b11a3c49b4a in QApplicationPrivate::notify_helper(QObject*, QEvent*) qapplication.cpp:3716
#3 0x2b11a3c8ec72 in QApplication::notify(QObject*, QEvent*) qapplication.cpp:3704
#4 0x2b11b8bccd0f in QCoreApplication::notifyInternal2(QObject*, QEvent*) qcoreapplication.cpp:988
#5 0x2b11aea5c34d in QCoreApplication::sendEvent(QObject*, QEvent*) qcoreapplication.h:231
#6 0x2b11aea5c34d in QGuiApplicationPrivate::_q_updateFocusObject(QObject*) qguiapplication.cpp:3690
#7 0x2b11aea61360 in QGuiApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) .moc/moc_qguiapplication.cpp:177
#8 0x2b11b8d1dc86 in QMetaObject::activate(QObject*, int, int, void**) qobject.cpp:3787
#9 0x2b11aea784a3 in QWindow::focusObjectChanged(QObject*) .moc/moc_qwindow.cpp:760
#10 0x2b11a3fb24f2 in QWidget::clearFocus() qwidget.cpp:6705
#11 0x2b11a3fc87b1 in QWidget::~QWidget() qwidget.cpp:1608
#12 0x2b11a526688c in QDialog::~QDialog() qdialog.cpp:352
#13 0x6c43e2 in EnterTestModalDialog::~EnterTestModalDialog() tst_qwidget.cpp:10160
#14 0x6c43e2 in EnterTestModalDialog::~EnterTestModalDialog() tst_qwidget.cpp:10160
#15 0x492be3 in EnterTestMainDialog::buttonPressed() tst_qwidget.cpp:10188
#16 0x492be3 in EnterTestMainDialog::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) .moc/tst_qwidget.moc:2056
#17 0x2b11b8d1dc86 in QMetaObject::activate(QObject*, int, int, void**) qobject.cpp:3787
#18 0x2b11a45cb833 in QAbstractButton::clicked(bool) .moc/moc_qabstractbutton.cpp:307
#19 0x2b11a45cd54b in QAbstractButtonPrivate::emitClicked() qabstractbutton.cpp:411
#20 0x2b11a45df73a in QAbstractButtonPrivate::click() qabstractbutton.cpp:404
[...]
#41 0x6bb2cf in tst_QWidget::taskQTBUG_27643_enterEvents() tst_qwidget.cpp:10249
[...]
Fix by checking the event type first, and accessing
modal->button only if it's QEvent::Enter.
Change-Id: I2c7df3a1f43ecbfe14741b5861729078a91a32d6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
If the Key_Space case falls through, it does because !d->lineEdit,
which makes the following case dead code, because it is guarded by the
same condition.
Fix by adding the break, which ensures that if those two cases ever
diverge, the code stays working by intention, not chance.
Independently discovered by GCC 7 and Coverity.
Coverity-Id: 11157
Change-Id: Id14114b4157549d0f6fa036e8aa2bf0fa5a863cf
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The old code fell through into from the CE_RubberBand case into the
CE_SizeGrip case if the cast of the the QStyleOption to a
QStyleOptionRubberBand failed.
Quite obviously, the drawing of a rubber band was requested by the
caller, drawing a size grip instead must be considered a bug,
regardless of any additional guards employed by the size grip case.
So, fix by removing the conditional return in the success case and
adding an unconditional break. The function ends after the switch,
and all other cases also break instead of return, so consider the
switch from return to break a contribution to the internal consistency
of the function.
Discovered independently by GCC 7 and Coverity.
Coverity-Id: 11182
Change-Id: I2158f03b9eb018b952716ffa5e615c7b3cc49132
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
By the time we hit the last else, its if condition is trivially
true, so don't check it (but leave it as a comment).
Consequently, remove the trailing (dead) return of a default-
constructed QString.
Coverity-Id: 62766
Change-Id: I47e1a49f40e6ec95d29c5052c78bfadb63af3b84
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
GCC 7 warns about implicit fall-throughs, and here it looks
like a break was indeed missing. It surely isn't catastrophic
that the other update code is executed, too, but it's also
useless.
Turns out Coverity knew it all along...
Coverity-Id: 11162
Change-Id: I88fc0174a66ec337b2d93c006e70be8d5f3bbc33
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
It is of course wrong to potentially return the text of the Cancel
button if the text of the Accept role button was asked for.
Found independently by GCC 7 and Coverity.
Coverity-Id: 11150
Change-Id: Ie30f7875daee16a78eeff4b314ce17cbd7cd3aa8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
A gradient table may be deallocated while in use because we don't keep
track of references. To fix it we now reference count the cache entries.
Task-number: QTBUG-14614
Change-Id: I772ebf565ccf41d476811ca9a51b721f10de8aeb
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The vast majority is due to leaking styles in a data-driven
test with almost 100 rows (scrollBarRanges()).
Fix by creating the style into a QScopedPointer.
The remaining ~500 leaks were due to leaked QGraphicsScenes.
They had no parent, and QGraphicsView::addScene() does not
adopt them.
Fix those by passing the resp. view as their (QObject) parent.
Change-Id: I4316798019114ea3d7504d72cd83d534a21149c0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
The QXmlInputSource objects were allocated on the heap,
but never deleted.
Fix by allocating them on the stack instead.
Change-Id: Ifd8bd41d778c0634b7a426bbd22a367dfce511c9
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>