Commit Graph

29127 Commits

Author SHA1 Message Date
Liang Qi
6370c3aa71 Merge remote-tracking branch 'origin/5.6' into 5.7
Also bump minimum required Qt version for Android: Ministro updates.

Conflicts:
	src/android/java/src/org/qtproject/qt5/android/bindings/QtActivityLoader.java
	src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java
	src/plugins/platforms/android/androidjnimain.cpp

Change-Id: I966f249bebf92da37bfdeb995ad21b027eb03301
2016-10-13 15:18:02 +02:00
Thiago Macieira
8796c69480 QNetworkSession: make sure that "interface" isn't #defined
Depending on #include order isn't a good idea.

Change-Id: Ief935e1fcc5d40ecb510fffd147c08dffe6cba2d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-10-13 11:25:41 +00:00
Thiago Macieira
b9a32351c8 findclasslist.pl: namespaces can be exported too
You can place the export macros in the namespace declarations on ELF
systems and that will apply to all declarations inside that scope. If a
namespace is exported like that, then we should mark it for versioning
too.

Note that the exporting doesn't happen for declarations in other scopes
of the same namespace, even though the findclasslist.pl script will mark
everything in that namespace. This should not be a problem.

Task-number: QTBUG-55897
Change-Id: I371f5b01e24a4d56b304fffd147274778b980ad2
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2016-10-13 08:29:02 +00:00
Alexander Volkov
ef416e0faa QIconLoaderEngine: add missing Q_DECL_OVERRIDEs
Change-Id: I7671b05f2e3c218870dca04f3ed52c231dbe4a9d
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-10-12 20:54:16 +00:00
Allan Sandfeld Jensen
f3ce959de6 Fix illegal memory access on simple image rotates
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>
2016-10-12 18:02:30 +00:00
Alexander Volkov
e732e432ab Remove unused static member QIconLoaderEngineEntry::count
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>
2016-10-12 18:00:16 +00:00
BogDan Vatra
cc62c30022 Android: Ministro updates
- bump minimum required Qt version
 - use market://details instead which opens Ministro's page directly

Change-Id: I3d879503625fe29e7b23149402217337fee6a863
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-10-12 11:19:45 +00:00
Christian Strømme
dde86ebb9b Android: Don't update offscreen windows
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>
2016-10-12 10:19:25 +00:00
Christian Strømme
f12006e644 Don't resize windows that aren't attached to a platform window
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>
2016-10-12 10:19:21 +00:00
Edward Welbourne
f4fff02cbb QXcbShmImage: don't use shmget()'s return unless it succeeds
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>
2016-10-12 09:33:05 +00:00
Marc Mutz
de48fd192b QToolBarAreaLayoutInfo: add missing break statements in switch in distance()
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>
2016-10-12 09:08:38 +00:00
Allan Sandfeld Jensen
00304a3d57 Blacklist tst_MacNativeEvents::testMouseEnter
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>
2016-10-12 08:17:16 +00:00
Marc Mutz
77372e0b66 harfbuzz: compile with GCC 7
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>
2016-10-12 08:16:56 +00:00
Marc Mutz
0c8b5b9a04 QtOpenGl: compile with GCC 7
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>
2016-10-12 08:16:52 +00:00
Marc Mutz
eade394e99 QtDBus: compile with GCC 7
GCC 7 warns about implicit fall-throughs now.

Fix by adding the missing comments.

Change-Id: I629fb3aced9296c81496f19f6ff78c7a5a12e991
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-12 08:16:49 +00:00
Marc Mutz
afe5bcdbd1 tst_QWidget: Fix UB (invalid member access) in EnterTestMainDialog::eventFilter()
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>
2016-10-12 08:16:45 +00:00
Marc Mutz
c34c8a564e QComboBox: add missing break in switch in keyPressEvent()
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>
2016-10-12 08:16:41 +00:00
Marc Mutz
1ab521e7f4 QFusionStyle: add missing break in switch in drawControl()
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>
2016-10-12 08:16:38 +00:00
Marc Mutz
2ecd95bbe9 QCalendarWidget: fix misleading if-else cascade in QCalendarDayValidator::text()
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>
2016-10-12 08:16:34 +00:00
Marc Mutz
eec2d5e68a QCalendarWidget: fix a missing break statement
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>
2016-10-12 08:16:31 +00:00
Marc Mutz
dafa7cc7b5 QFileDialog: add missing break statements in switch in labelText()
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>
2016-10-12 08:16:28 +00:00
Allan Sandfeld Jensen
9ad4157530 Fix gradient race condition / read-after-free
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>
2016-10-12 08:16:24 +00:00
Marc Mutz
f6498fd677 Plug more than 4k leaks in tst_QGraphicsView
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>
2016-10-11 20:52:42 +00:00
Kai Koehne
4e13abb9eb Doc: Mention context menu related API in QWidget overview
Change-Id: I357e3468694cc7e2af2f5e8d6dd28c16d2772192
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2016-10-11 08:01:15 +00:00
Marc Mutz
6d6074e04f Plug leaks in tst_QXmlSimpleReader
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>
2016-10-10 17:17:28 +00:00
Marc Mutz
940ea856f0 QtSql: compile with GCC 7
GCC 7 warns about implicit fall-throughs now.

Fix by adding the missing comments.

Change-Id: I7383f47e690b6334ef69c9df745c2205247ca7d0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
2016-10-10 17:17:22 +00:00
Allan Sandfeld Jensen
8356caea45 Fix QPixelFormat::typeInterpretation() for Format_RGB888
RGB888 is byte oriented like the RGBA8888 formats.

Task-number: QTBUG-56250
Change-Id: Idbd496e4913e5d168decdd41557e28a71574a85b
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2016-10-10 17:17:10 +00:00
Edward Welbourne
bff683416c QDateTimeEditPrivate:: only ask for fieldInfo() if section index is real
On construction, currentSectionIndex has the fake value
FirstSectionIndex, which upsets fieldInfo(), leading to a qWarning().
Make interpret(), when deciding whether to delegate to base or handle
the value itself, treat fake index value as an invalid state.

Task-number: QTBUG-54654
Change-Id: I6d0f71874839abfafcbfaaa0018362288f32a3cd
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2016-10-10 16:19:53 +00:00
Timur Pocheptsov
1a78ef09b9 Revert "QCocoaKeyMapper - correctly update key layouts"
This reverts commit 26961e32f3.
This patch was apparently a bit ill-considered and while fixed
one problem introduced others.

Task-number: QTBUG-50865
Change-Id: I2e3569d16c8fc47b4a492d4aed6e747d7ff93a55
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2016-10-10 09:54:06 +00:00
Liang Qi
3e71810cf3 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/network/access/qhttpnetworkconnection.cpp
	src/network/access/qhttpnetworkconnection_p.h

Change-Id: I11f8641ef482efa8cee1b79977d19cc3182814b4
2016-10-08 17:15:55 +02:00
Frederik Schwarzer
ebd1046323 QEvent: fix typo in apidoc
Change-Id: I43911d781024b5e76ff5065964a570663de6e33c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2016-10-08 11:23:10 +00:00
Dmitry Shachnev
75b49a59db dbustray: Support replacing menu on QDBusTrayIcon
If a new menu is set via the updateMenu() method, properly unregister
the old menu and register the new one.

Task-number: QTBUG-53676
Change-Id: I8c1ea2d171caec01488f0fe8a565bc9b2f7e431e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2016-10-07 14:24:38 +00:00
Frank Reininghaus
5cc0d92c24 QAbstractItemView: use only a 1x1 QRect for selecting on mouse press
Before commit f1e9076809, mousePressEvent
called the virtual method setSelection(const QRect&, SelectionFlags)
with the 1x1 rectangle which contains only the clicked QPoint, unless
the SelectionFlag "Current" was set because Shift was pressed during
the mouse press.

Since that commit, the behavior has been changed such that the
rectangle is the one that is spanned by the center of the clicked item
and the clicked pixel. In theory, the result should be the same (i.e.,
only the clicked item should be selected), but

* the code path in QListView::setSelection for 1x1 QRects is more
  efficient, and
* using a larger QRect can cause problems with custom views, see the
  comments in QTBUG-18009

This commit ensures that the 1x1 QRect is used again, unless the
SelectionFlag "Current" is used.

Change-Id: I70dd70c083c20a3af6cd6095aa89a489756b505f
Task-number: QTBUG-18009
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2016-10-07 10:38:58 +00:00
Allan Sandfeld Jensen
c6f5e4b47c Fix multimedia print key mapping
Qt::Key_Print is the PrintScreen key-mapping. Instead use
Qt::Key_Printer which is also what VK_PRINT is mapped to.

Change-Id: I60a0181ed118253b6681ae0e5847812f73d63119
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-10-07 10:20:30 +00:00
Erik Verbruggen
eda095ebb4 Darwin: correct state restore when FSEventsStream starting fails
The previous state was not restored completely when adding/removing
paths resulted in a stream start failure.

It also removes an autoreleasepool in restartStream, because both
stopStream and startStream do already create an autoreleasepool of their
own. (So, this pool will always be empty.)

Change-Id: Idc674e9c040f346703ab3ec256957e787a0ade73
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2016-10-07 09:13:34 +00:00
Sergio Martins
c353bf0033 Link to topLevelChanged() in the docs of QDockWidget::floating
topLevelChanged() is emitted when the floating property changes.
It's not very well named, it's easy to miss.

Change-Id: Iabaa4fb3dc6190df43d719ed7565f0586816c6de
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
2016-10-07 08:56:05 +00:00
Samuli Piippo
62d13e2e9b Skip chmod for separate_debug_info when cross compiling on Windows
Task-number: QTBUG-56289
Change-Id: If6dd07182ed77e87865004c14240bf7f0c764772
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-10-07 05:25:42 +00:00
Sune Vuorela
4268dde1f1 QTemporaryFile's setFileTemplate operates not only on XXXXXX in the end
Is even covered by unit tests.

Change-Id: I7b22da2a338868fdb99c6238925f944bfea88190
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-06 21:33:29 +00:00
Sérgio Martins
dd00f6dd91 Handle short reads in the local sockets example
Protection against short reads was already half implemented,
blockSize was being sent by the server but never used by the client.

Also, blockSize was bumped to quint32: If you're in a position where
short reads can happen then quint16 is probably not enough to hold the
size of your data. On Linux I could only reproduce short reads for
messages > 500K.

Change-Id: I191a3d781da1d8a119debbdafae641c8340a1da2
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2016-10-06 21:20:33 +00:00
Marc Mutz
f9acbaccde QPixmap::load: ensure QBitmap stays a QBitmap even on failure
... and avoid detach()ing potentially large data for just
preserving the QPlatformPixmap::pixelType().

A QBitmap differs from a QPixmap (its base class, urgh)
by always having a data != nullptr and a Bitmap pixel
type, yet load() was unconditionally setting 'data' to
nullptr on failure, turning a QBitmap into a non-QBitmap.

Fix by move-assigning a null QBitmap instead of resetting
'data'.

Add some tests.

Change-Id: Ida58b3b24d96472a5f9d0f18f81cc763edcf3c16
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2016-10-06 16:39:13 +00:00
Marc Mutz
237b36a72c QGraphicsWidget: Fix UB (invalid member calls) in destruction sequence
Found by UBSan:

  qgraphicswidget_p.h:72:5: runtime error: downcast of address 0x2ab6a8021400 which does not point to an object of type 'QGraphicsWidget'
  0x2ab6a8021400: note: object is of type 'QGraphicsObject'
   00 00 00 00  70 93 5c 91 b6 2a 00 00  f0 c0 01 a8 b6 2a 00 00  e8 81 5c 91 b6 2a 00 00  10 bf 01 a8
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QGraphicsObject'
    #0 0x2ab68f2fdd7c in QGraphicsWidgetPrivate::q_func() qgraphicswidget_p.h:72
    #1 0x2ab68f2fdd7c in QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget*, QGraphicsScene*, QGraphicsScene*) qgraphicswidget_p.cpp:775
    #2 0x2ab68f020d2a in QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem*, QVariant const*, QVariant const*) qgraphicsitem.cpp:1181
    #3 0x2ab68f024f73 in QGraphicsItem::setParentItem(QGraphicsItem*) qgraphicsitem.cpp:1781
    #4 0x2ab68f168401 in QGraphicsScenePrivate::removeItemHelper(QGraphicsItem*) qgraphicsscene.cpp:620
    #5 0x2ab68f02c166 in QGraphicsItem::~QGraphicsItem() qgraphicsitem.cpp:1555
    #6 0x2ab68f02ebb8 in QGraphicsObject::~QGraphicsObject() qgraphicsitem.cpp:7766
    #7 0x2ab68f2d8888 in QGraphicsWidget::~QGraphicsWidget() qgraphicswidget.cpp:231
    #8 0x4bce62 in SubQGraphicsWidget::~SubQGraphicsWidget() /tst_qgraphicswidget.cpp:175
    #9 0x4bce62 in SubQGraphicsWidget::~SubQGraphicsWidget() /tst_qgraphicswidget.cpp:175
    #10 0x2ab68f02c9ec in QGraphicsItem::~QGraphicsItem() qgraphicsitem.cpp:1550
    #11 0x2ab68f02ebb8 in QGraphicsObject::~QGraphicsObject() qgraphicsitem.cpp:7766
    #12 0x2ab68f2d8888 in QGraphicsWidget::~QGraphicsWidget() qgraphicswidget.cpp:231
    #13 0x4bce62 in SubQGraphicsWidget::~SubQGraphicsWidget() /tst_qgraphicswidget.cpp:175
    #14 0x4bce62 in SubQGraphicsWidget::~SubQGraphicsWidget() /tst_qgraphicswidget.cpp:175
    #15 0x2ab68f128da4 in QGraphicsScene::clear() qgraphicsscene.cpp:2388
    #16 0x2ab68f12936c in QGraphicsScene::~QGraphicsScene() qgraphicsscene.cpp:1682
    #17 0x44d44c in tst_QGraphicsWidget::focusWidget() /tst_qgraphicswidget.cpp:435

  qgraphicswidget_p.cpp:805:24: runtime error: member call on address 0x2ab6a8021400 which does not point to an object of type 'QGraphicsWidget'
  0x2ab6a8021400: note: object is of type 'QGraphicsObject'
   00 00 00 00  70 93 5c 91 b6 2a 00 00  f0 c0 01 a8 b6 2a 00 00  e8 81 5c 91 b6 2a 00 00  10 bf 01 a8
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QGraphicsObject'
    #0 0x2ab68f2fdc68 in QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget*, QGraphicsScene*, QGraphicsScene*) qgraphicswidget_p.cpp:805
    #1 0x2ab68f020d2a in QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem*, QVariant const*, QVariant const*) qgraphicsitem.cpp:1181
    [... identical lines omitted ...]

  qgraphicswidget_p.cpp:806:23: runtime error: member call on address 0x2ab6a8021400 which does not point to an object of type 'QGraphicsWidget'
  0x2ab6a8021400: note: object is of type 'QGraphicsObject'
   00 00 00 00  70 93 5c 91 b6 2a 00 00  f0 c0 01 a8 b6 2a 00 00  e8 81 5c 91 b6 2a 00 00  10 bf 01 a8
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QGraphicsObject'
    #0 0x2ab68f2fdb6b in QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget*, QGraphicsScene*, QGraphicsScene*) qgraphicswidget_p.cpp:806
    #1 0x2ab68f020d2a in QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem*, QVariant const*, QVariant const*) qgraphicsitem.cpp:1181
    [... identical lines omitted ...]

  qgraphicswidget_p.cpp:827:26: runtime error: member call on address 0x2ab6a8021400 which does not point to an object of type 'QGraphicsWidget'
  0x2ab6a8021400: note: object is of type 'QGraphicsObject'
   00 00 00 00  70 93 5c 91 b6 2a 00 00  f0 c0 01 a8 b6 2a 00 00  e8 81 5c 91 b6 2a 00 00  10 bf 01 a8
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QGraphicsObject'
    #0 0x2ab68f2fdf91 in QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget*, QGraphicsScene*, QGraphicsScene*) qgraphicswidget_p.cpp:827
    #1 0x2ab68f020d2a in QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem*, QVariant const*, QVariant const*) qgraphicsitem.cpp:1181
    [... identical lines omitted ...]

Fix by moving the setParentItem(nullptr) call up the call stack
into ~QGraphicsWidget(), ensuring that the object is still a
QGraphicsWidget when these calls are made.

Change-Id: I264779e33098e9752de9a312a146fb203578a3cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2016-10-06 16:39:09 +00:00
Marc Mutz
daaa1a287b Plug leak in QFormLayout::setWidget()
Unlike layouts and spacer items, a QWidget is-not-a QLayoutItem.
QWidgetItem simply wraps the QWidget, so in QFormLayout::setWidget(),
we allocate a widget item for the widget passed, and hand that down
to Private::setItem() for adding to the various data structures.

Private::setItem() has a bunch of guard clauses, though, that return
without deleting the item.

A test triggered this code path and made asan complain.

This is just one part of a larger problem: QFormLayout::setLayout()
normally takes ownership of the layout passed, because QLayouts own
their QLayoutItems, and QLayout is-a QLayoutItem. But setLayout()
fails to live up to the owner role when it fails to add a layout,
and there's no easy way for the API user to check for success.

A fix for this breaks tst_qformlayout, and while those checks that
break deserve to be broken, I'll refrain from proposing the larger
fix for 5.6 LTS, but will propose it for 5.8 or 5.9 instead.

This fix here only fixes the leak in setWidget() by adding a bool
return to Private::setItem() informing Private::setWidget() of the
need to manually delete the item it allocated for the widget.

Change-Id: I81409c260f9bee2e95c9a98542d8c60bc19a1332
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2016-10-06 16:39:05 +00:00
Marc Mutz
0f21e0bc19 QDBusDemarshaller: use RAII in duplicate()
QtDBus is compiled with exceptions disabled, but checkers
don't know that, and it's not 100% certain it will stay
that way until eternity.

So do the simple change and hold the new'ed pointer in a
QScopedPointer until handing it off to create().

Coverity-Id: 154477
Change-Id: I91a763ca4e93585c97cb9e794312b53046971161
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-06 16:39:01 +00:00
Frederik Schwarzer
0bf0c3e184 Use the same object in description as in described code
Change-Id: If52ecfc8d29a83cb2949fbbf4672ae386ae5d739
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2016-10-06 13:54:02 +00:00
Richard Moe Gustavsen
4b975405d7 QTextEdit: don't show placeholder text while composing text
If using IM to compose text in QTextEdit, the placeholder text
will show underneath until the text is committed.

This patch will additionally check if the user is currently
composing preedit text before deciding whether or not to draw the
placeholder text.

Task-number: QTBUG-55758
Change-Id: If7943c6c94fb96d46514a81caa118829e6e6a0f9
Reviewed-by: Liang Qi <liang.qi@qt.io>
2016-10-06 13:53:11 +00:00
Kai Koehne
8f4054a7e6 Doc: Document that by default, QTimer is not single-shot
Change-Id: I586997ddb5ed55d68f53ddfe9302b961296cc4eb
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-10-06 13:51:48 +00:00
BogDan Vatra
98cb497772 Add QMAKE_LFLAGS_SONAME to linker flags for Android plugins
It's needed to shut up Android 6+ warnings

Task-number: QTBUG-52112
Change-Id: I21ff53d687bf545250ec7fcdc059db16d4cecbc9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-10-06 13:33:08 +00:00
Vladimir Prus
840e2dd2f0 Make sure SSL configuration is correct in QNetworkReply::encrypted.
In some cases, when QNetworkReply::encrypted is emitted,
QNetworkReply::sslConfiguration is not yet initialized, in particular
certificate chain is empty, which breaks the documented usage of
'encrypted' to perform additional checks on certificate chain.

It looks to be caused by the fact that QHttpNetworkReply is originally
associated with 0th QHttpNetworkConnectionChannel, and this association
is not updated if HTTP pipelining is not used. Therefore, a reply on
channel >0 might arrive before reply on channel 0, and then using ssl
configuration from channel 0, which not made it through handshake, is
not usable.

Task-number: QTBUG-49554
Change-Id: Ie5d4b5a0c503d5bdc44761ce8581f6ffe4e3bac2
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
2016-10-05 19:46:51 +00:00
Marc Mutz
dc737fa0d7 tst_QShortcut: Fix UB (invalid cast) in shortcutDestroyed()
The slot is invoked from QObject::destroyed(), which is emitted
from ~QObject. By that time the object is no longer a QShortcut,
so the static_cast it invalid.

Found by UBSan:

  tst_qshortcut.cpp:1210:53: runtime error: downcast of address 0x6020000289d0 which does not point to an object of type 'QShortcut'
  0x6020000289d0: note: object is of type 'QObject'
   10 00 80 17  c0 ce 63 df 93 2b 00 00  b0 02 00 00 d0 60 00 00  02 00 00 00 ff ff ff 04  04 00 00 00
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QObject'
    #0 0x42b3bb in tst_QShortcut::shortcutDestroyed(QObject*) tst_qshortcut.cpp:1210
    #1 0x446cc9 in tst_QShortcut::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) .moc/tst_qshortcut.moc:186
    #2 0x2b93dba52c86 in QMetaObject::activate(QObject*, int, int, void**) qobject.cpp:3787
    #3 0x2b93dba55400 in QObject::destroyed(QObject*) .moc/moc_qobject.cpp:213
    #4 0x2b93dba8d80d in QObject::~QObject() qobject.cpp:967
    #5 0x2b93c6b6e032 in QShortcut::~QShortcut() qshortcut.cpp:476
    #6 0x2b93c6b6e370 in QShortcut::~QShortcut() qshortcut.cpp:481
    #7 0x42a5de in void qDeleteAll<QList<QShortcut*>::const_iterator>(QList<QShortcut*>::const_iterator, QList<QShortcut*>::const_iterator) qalgorithms.h:317
    #8 0x42a5de in void qDeleteAll<QList<QShortcut*> >(QList<QShortcut*> const&) qalgorithms.h:325
    #9 0x42a5de in tst_QShortcut::clearAllShortcuts() tst_qshortcut.cpp:1136

Fix by replacing QVector::replaceAll() with the erase-remove idiom,
which does not require the cast, because it can perform mixed-type
lookups.

Change-Id: I4251c1895fa4398023f489dbfd7108d90c1a6c94
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2016-10-05 17:47:09 +00:00
Marc Mutz
59414b7c58 Plug memleak in tst_QStackedWidget
To keep the change minimal, keep 'sw' as a pointer variable,
but back it by a stack-allocated QStackedWidget instead of a
heap-allocated one that's never deleted.

Change-Id: I9e2a8c07979b861eb7e7040c144d8e75c90d0bc9
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2016-10-05 17:45:49 +00:00