mkdir(data2) depended on mkdir(data1) being run before, or it would
fail. In addition, the rmdir() test required the equivalent mkdir() test
being run before. So drop these annoying dependencies and make the tests
cleaner by having clear separation of the test data and merging the two
tests into one
The entryList() test still depends on the testdir being clean: it will
fail if mkdirRmdir() previously failed.
Change-Id: Iaddbecfbba5441c8b2e4fffd14a3e35972d2a3d8
Reviewed-by: David Faure <david.faure@kdab.com>
QString::toUtf8() returns QByteArray, which got implicitly converted to
C strings and promptly deleted. Instead, return the QByteArray to the
caller.
Found by ASAN:
==13935==ERROR: AddressSanitizer: heap-use-after-free on address 0x6060000dffb8 at pc 0x7f764f27320b bp 0x7ffd49b11bb0 sp 0x7ffd49b11358
READ of size 7 at 0x6060000dffb8 thread T0
#1 0x7f7649d174e2 in g_strdup (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x684e2)
#2 0x7f763f7abe5b (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x39e5b)
#3 0x7f763f78915a in g_object_new_valist (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x1715a)
#4 0x7f763f789520 in g_object_new (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x17520)
#5 0x7f7640f6bcb0 in gtk_dialog_add_button (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x186cb0)
#6 0x7f7640f8d2c9 in gtk_file_chooser_dialog_new (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x1a82c9)
#7 0x7f7641727281 (/opt/Qt5.8.0/5.8/gcc_64/plugins/platformthemes/libqgtk3.so+0x13281)
Task-number: QTBUG-59611
Change-Id: I37cc967e689f4523b504fffd14adbf944b53b754
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
The value is hard-coded, there's no need to parse a string to extract the value.
Change-Id: I987280d7a92b7a1eb75233b2a1f811b5177f0a63
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Can be used by CI system to set QTEST_ENVIRONMENT="ci", allowing test to
be blacklisted only for the CI.
Task-number: QTBUG-59564
Change-Id: I7088abb888c179bafc621f11191efbc45c37b179
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Don't cast an expiring QObject down to QWidget. Cast the QWidgets stored
internally up to QObject to perform the comparison. The result is the
same, but no invalid casts are possible anymore.
Found by independent review.
Change-Id: Iffa8a66cf5cab0270961befe982637ac8e4f0f7b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
WidgetMapper is larger than a void*, so holding it in QLists is
needlessly inefficient. Worse, the code could come to depend on the
fragile property of (inefficient) QLists that references to elements
therein never are invalidated.
Fix by holding it in a std::vector instead (tried QVector, too, but
that produced almost exactly 1KiB more text size). Adapt to std API.
There are a few changes in there which are not strictly necessary when
using std::vector, but were done as part of the port to QVector:
- dropping of WidgetMapper ctors (because QVector requires a default
ctor, and I didn't want to provide one manually),
- marking the type as movable (no effect with std::vector, but doesn't
hurt and keeps the next guy from wondering), and
- marking Private::flipEventFilters() const (to avoid a detach when
using ranged for loops).
Changes required by the port to std::vector:
- at() -> op[] (not strictly necessary, but expands to less code even
when compiling, as QtWidgets is, without exception support),
- append() -> push_back()
Saves 40B in text size on optimized GCC 6.1 Linux AMD64 builds (for
comparison: QVector had 1240B more than QList).
Change-Id: Iaae81d1a8bebe8000bf69e7fb8b2bcd6c38afafd
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
We don't load and save pointers usually because the pointer value cannot
be guaranteed to remain across program invocations. However, nullptr is
an exception: a null pointer is always a null pointer.
We don't actually have to read or write anything: there's only one value
possible for a std::nullptr_t and it is nullptr.
[ChangeLog][Important Behavior Changes] A QVariant containing a
std::nullptr_t is now streamable to/from QDataStream.
Task-number: QTBUG-59391
Change-Id: Iae839f6a131a4f0784bffffd14aa374f6475d283
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The only allowed way to access the variable is now via the public
qGlobalQHashSeed and qSetGlobalQHashSeed functions. The variable was
private API, so we're allowed to remove it.
Task-number: QTBUG-47566
Change-Id: I4a7dc1fe14154695b968fffd14abd331e5810482
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
The warning comes from the MS headers, not from the compiler.
Task-number: QTBUG-59576
Change-Id: Ie67d35dff21147e99ad9fffd14acd7fb628fa1d4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Task-number: QTBUG-59218
Change-Id: Ic839a36af1ecab39da0c3394c34181b6717e24e2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Add the option to omit code generated by wayland-scanner, to
avoid the case where the Qt versions replace driver-specific
functionality.
Task-number: QTBUG-58299
Change-Id: I508b18b9392dbd9e2b8233399301c06410f9f5ba
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
QUrl::isRelative(str) would be false for such files, so first check for
file existence before doing any URL parsing.
Change-Id: I51b6229251ad94877ac408b2f8018456d3e10a36
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When a text block is empty, and we are adding preedit text to it,
we need to merge the format of the preedit text with the current
format of the cursor, otherwise we will use a default format and
then suddenly switch to the proper one when the text is committed.
The reason this becomes a bit complex is that there are no rules
preventing someone from using several ime attributes to specify
formats for isolated parts of the text, and no rules defining the
order of such attributes. So even if the common case is one
text format attribute for the entire string, we need to make sure
we also handle the other cases gracefully, e.g. when we are setting
different formats for different substrings and then providing these
out of order. To make sure we have these corner cases covered, we
also add a set of autotests.
[ChangeLog][Qt Widgets][TextEdit] Fixed initial char format of
input method text as it is in pre-edit mode.
Task-number: QTBUG-59196
Change-Id: I1e37928e3bd1395fec1b5591908d4c69b84eb618
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
psql driver was previously using QDateTime::toString() function which is locale-depndent.
Task-number: QTBUG-59524
Change-Id: I7f50f95b5c82e66476abfee24ad28b78b3257041
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
An QApplication::mouseButtons() value could stay outdated after external
DnD operations, e.g. dragging an object outside Qt application or vice
versa. Also user can cancel DnD with Escape key.
Task-number: QTBUG-55885
Task-number: QTBUG-59539
Change-Id: Ia6deb4ae5ccfe77e6d6c2464de40cd06fc71f9b8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
When only minimumSize was set and it matched to the size NSView was
created with, viewDidChangeFrame() was not called for the window and
it's internal geometry value was still (0, 0) what led to unpleasant
side effects such as QML content was not displayed until something
caused an update.
Task-number: QTBUG-58963
Change-Id: Ib12d36d405969971e7ff62b79b50c3d78928a649
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Generally, this might avoid unnecessary work in a quite common case.
But if high dpi scaling is set, the dpi (in logical pixels) does
not change. However this event is sent before
QGuiApplicationPrivate::processWindowScreenChangedEvent has had
time to change the geometry, and might cause a problem in QMenu
Amends f3a4b4258f.
Task-number: QTBUG-59484
Change-Id: Ie4ceedcb0754613cf239ae86b225c4139b70d0cc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Commit e0ea0f6178 optimized QChar <->
QString(Ref) comparisons by adding more overloads to avoid creating
QStrings from QChars just to compare them.
But these new overloads made existing comparisons to QChar ambiguous.
This was known at the time for QChar/int comparisons.
It has since turned out that also comparing to '\0' is ambiguous,
ie. not comparing to int or char per se is ambiguous, but comparing to
nullptr constants is, because QString(const char*) is just as good a
candidate as QChar(char)/QChar(int).
Since we allow QString/QChar comparisons, it seems logical to solve
the problem by adding QChar<->nullptr overloads.
[ChangeLog][QtCore][QChar] Disambiguated comparisons with nullptr
constants such as '\0', which 5.8.0 broke. As a consequence,
QChar<->int comparisons are no longer deprecated, as this was a failed
attempt at fixing the ambiguity.
Change-Id: I680dd509c2286e96894e13078899dbe3b2dd83bc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The mmap64 functions in all Linux libc fail to properly check that the
value fits in the system call parameter. I guess the developers just
said "16 PB are enough for everyone"...
Change-Id: Ic39b2c4fd9c84522a8fafffd14ac91567ce09c09
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Timer IDs have been reused since Qt 4.5 or thereabouts, so just checking
if the timer ID is in the timer dictionary is an incorrect check: our
timer may have been deleted and replaced by another with the same ID.
Instead of deleting the WinTimerInfo object, let's just mark it as
unregistered by setting timerId to -1 and cooperate in deleting at the
appropriate places. Since unregisterTimer skips deleting if inTimerEvent
is true, the appropriate places are everywhere that set inTimerEvent to
true.
Change-Id: I057e93314e41372ae7a5ff93c467767c8a6d92ea
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
It has started failing recently on the CI, too.
Task-number: QTBUG-58745
Change-Id: I4c8834917e6455d00c300549ed448b06da75d5bc
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
in the vain hope to get the CI unstuck again.
Change-Id: I1b01bb1d59a8850f68d1d80838f5606f4159bcbd
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Fixes the bug in QFile which allowed opening a file with reserved
characters in its name. If the name is a long file path, CreateFile
opens a file with a truncated name instead of failing, so we have
to catch reserved characters ourselves.
[ChangeLog][Windows] Fixed a bug that caused QFile to create
files with truncated names if the file name was invalid. Now,
QFile::open correctly fails to create such files.
Task-number: QTBUG-57023
Change-Id: I01d5a7132054cecdfa839d0b8de06460039248a3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Much simpler, no memory allocation, no locking.
Change-Id: Iae839f6a131a4f0784bffffd14a9e70c7b62d9a7
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Some users have reported crashes in -[QNSView mouseEnteredImpl:]
which we believe are due to null m_platformWindow. The stack
traces are like the one below or similar:
0 libqcocoa_dylib QNSView mouseEnteredImpl_ 0x1F
1 appkit NSTrackingArea _dispatchMouseEntered_ 0xA2
2 appkit NSApplication sendEvent_ 0xF4D
3 libqcocoa_dylib QNSApplication sendEvent_ 0x4E
4 libqcocoa_dylib QCocoaEventDispatcher processEvents 0x184
5 qtcore QEventLoop exec 0x19C
6 qtwidgets QDialog exec 0x20B
Moreover, since 2f505b79a4, that
member is a QPointer, so we should do more systematic checks.
Change-Id: Iced447515a4ae07a62734e587f5b08d46d313071
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
the View's position and metrics are in pixels, not points
Change-Id: I285d5378db98187f54019bff9b8a1cde05dc3b35
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Notify users when multithreaded OpenGL is disabled due to the
renderer or vendor blacklist.
Change-Id: I16a80568afe87b227575102ca839f18050613e90
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
QWindow::setVisible calls QWindowPrivate::applyCursor without checking
if screen() returns null. This patch adds a check in QWindowPrivate::applyCursor
that the screen is not null. Now that it is tested there, no need to test
it from the other caller (setCursor)
This patch should not change behavior of setCursor at all, it should only
fix the crash when coming from setVisible
Task-number: QTBUG-59528
Change-Id: I06bbdb4e04c02ac840ba637242d1f2cfde5bdd62
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
No test were hitting the code path for tiled non-ARGB32PM bilinear
filtered scaling. In part because we were only using brushes in pixmap
mode which are always converted to RGB32 or ARGB32PM.
Change-Id: Ib466567f31ce6ee894acdf484d44b3af62dad6fc
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Secure Transport supports more ciphers then we can convert into QSslCipher.
This results in our tests failing, since after the successful SSL handshake
sessionCipher is 'unknown'. This patch adds missing AES256-GCM-SHA384 and also,
to make new cipher addition easier in future, sorts cipher suites as it's done
in CipherSuite.h (ST framework's header) - grouped by RFC they were introduced
in + sorted within their group.
As a bonus (thanks to Eddy for spotting this problem) - some copy & paste (?)
typos were fixed (mismatched names).
Task-number: QTBUG-59480
Change-Id: I61e984da8b37f1c0787305a26fc289e2e7c2b4ad
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The constructor is not only disabled under QT_NO_CAST_FROM_ASCII,
but also under QT_RESTRICTED_CAST_FROM_ASCII.
Change-Id: I7bbaf2891913d5256dff7f80c49075ea3326155a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of relying on a private symbol exported from QtCore.
Task-number: QTBUG-47566
Change-Id: I4a7dc1fe14154695b968fffd14abd2b21a18203b
Reviewed-by: David Faure <david.faure@kdab.com>
Closing the dialog at the end of the test ends the modal session via
QCocoaEventDispatcherPrivate::endModalSession(), but the actual ending
of the session is deferred to cleanupModalSessions(), and that is never called.
The result is that QCocoaWindow::setVisible of the window in testKeyPressOnToplevel
and following tests ends up calling [m_nsWindow orderFront:nil]; instead of
[m_nsWindow makeKeyAndOrderFront:nil];, leaving the window inactive and the
tests failing.
Task-number: QTBUG-58474
Change-Id: If66b2e201f658b627c2ec50a562938f59a5037ed
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
- recursion is not needed for walking up the parent chain;
- use camel-case, modal_window -> modalWindow;
Change-Id: I4b7697f2388fd16f11be67ba475bd63ad249d89e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>