summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-04-06 01:00:07 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-04-06 01:00:08 +0200
commitce7f14d2e0791acc92622fdc23886a06d6712e90 (patch)
tree5f2b0f0a6c4a37dfaa1f31abf7e58d8a3cec1e3c
parent0998a9d1d53361e572d7377af8cb41a49bbfad72 (diff)
parentf4c41b9797f08f173049502fa7bd465cf5bde938 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp2
-rw-r--r--qmake/generators/makefile.cpp2
-rw-r--r--qmake/generators/unix/unixmake2.cpp2
-rw-r--r--qmake/meta.cpp7
-rw-r--r--qmake/meta.h2
-rw-r--r--src/corelib/global/qlogging.cpp3
-rw-r--r--src/corelib/global/qtrace_p.h17
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp9
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp8
-rw-r--r--src/corelib/qtcore.tracepoints10
-rw-r--r--src/corelib/tools/qstring.cpp4
-rw-r--r--src/gui/image/qpnghandler.cpp8
-rw-r--r--src/gui/kernel/qguiapplication.cpp8
-rw-r--r--src/gui/painting/qbrush.cpp4
-rw-r--r--src/gui/qtgui.tracepoints6
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp88
-rw-r--r--src/tools/tracegen/etw.cpp27
-rw-r--r--src/tools/tracegen/lttng.cpp17
-rw-r--r--src/tools/tracegen/provider.cpp19
-rw-r--r--src/tools/tracegen/provider.h1
-rw-r--r--src/widgets/kernel/qapplication.cpp2
-rw-r--r--src/widgets/qtwidgets.tracepoints7
-rw-r--r--tests/auto/network/kernel/qhostinfo/BLACKLIST2
-rw-r--r--tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp68
-rw-r--r--tests/manual/dialogs/filedialogpanel.cpp9
25 files changed, 244 insertions, 88 deletions
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index 5407ed6c69..07832041a7 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -856,7 +856,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
QString lib_file = QMakeMetaInfo::checkLib(Option::normalizePath(
(*lit) + Option::dir_sep + lib + Option::prl_ext));
if (!lib_file.isEmpty()) {
- QMakeMetaInfo libinfo(project);
+ QMakeMetaInfo libinfo;
if(libinfo.readLib(lib_file)) {
if(!libinfo.isEmpty("QMAKE_PRL_TARGET")) {
library = (*lit) + Option::dir_sep + libinfo.first("QMAKE_PRL_TARGET");
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 7364353183..b634ec622b 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -912,7 +912,7 @@ MakefileGenerator::processPrlFileCore(QString &origFile, const QStringRef &origN
const QString meta_file = QMakeMetaInfo::checkLib(fixedFile);
if (meta_file.isEmpty())
return false;
- QMakeMetaInfo libinfo(project);
+ QMakeMetaInfo libinfo;
debug_msg(1, "Processing PRL file: %s", meta_file.toLatin1().constData());
if (!libinfo.readLib(meta_file)) {
fprintf(stderr, "Error processing meta file %s\n", meta_file.toLatin1().constData());
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index fa283d0291..7d8c70ec3b 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -407,7 +407,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
const ProStringList &l = project->values("QMAKE_PRL_INTERNAL_FILES");
ProStringList::ConstIterator it;
for(it = l.begin(); it != l.end(); ++it) {
- QMakeMetaInfo libinfo(project);
+ QMakeMetaInfo libinfo;
if (libinfo.readLib((*it).toQString()) && !libinfo.isEmpty("QMAKE_PRL_BUILD_DIR")) {
ProString dir;
int slsh = (*it).lastIndexOf(Option::dir_sep);
diff --git a/qmake/meta.cpp b/qmake/meta.cpp
index 2e8759b8ba..c5c14d9b56 100644
--- a/qmake/meta.cpp
+++ b/qmake/meta.cpp
@@ -35,13 +35,6 @@ QT_BEGIN_NAMESPACE
QHash<QString, ProValueMap> QMakeMetaInfo::cache_vars;
-QMakeMetaInfo::QMakeMetaInfo(QMakeProject *_conf)
- : conf(_conf)
-{
-
-}
-
-
bool
QMakeMetaInfo::readLib(const QString &meta_file)
{
diff --git a/qmake/meta.h b/qmake/meta.h
index 4721085fd2..5f41a37df0 100644
--- a/qmake/meta.h
+++ b/qmake/meta.h
@@ -41,11 +41,9 @@ class QMakeProject;
class QMakeMetaInfo
{
- QMakeProject *conf;
ProValueMap vars;
static QHash<QString, ProValueMap> cache_vars;
public:
- QMakeMetaInfo(QMakeProject *_conf);
// These functions expect the path to be normalized
static QString checkLib(const QString &lib);
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index b2093101fa..ece97077c1 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -57,6 +57,7 @@
#include "private/qloggingregistry_p.h"
#include "private/qcoreapplication_p.h"
#include "private/qsimd_p.h"
+#include <qtcore_tracepoints_p.h>
#endif
#ifdef Q_OS_WIN
#include <qt_windows.h>
@@ -1811,6 +1812,8 @@ static void ungrabMessageHandler() { }
static void qt_message_print(QtMsgType msgType, const QMessageLogContext &context, const QString &message)
{
#ifndef QT_BOOTSTRAPPED
+ Q_TRACE(qt_message_print, msgType, context.category, context.function, context.file, context.line, message);
+
// qDebug, qWarning, ... macros do not check whether category is enabled
if (isDefaultCategory(context.category)) {
if (QLoggingCategory *defaultCategory = QLoggingCategory::defaultCategory()) {
diff --git a/src/corelib/global/qtrace_p.h b/src/corelib/global/qtrace_p.h
index 3d04a7311d..20f2beac98 100644
--- a/src/corelib/global/qtrace_p.h
+++ b/src/corelib/global/qtrace_p.h
@@ -52,11 +52,18 @@
//
/*
- * The Qt tracepoints API consists of only three macros:
+ * The Qt tracepoints API consists of only five macros:
*
* - Q_TRACE(tracepoint, args...)
* Fires 'tracepoint' if it is enabled.
*
+ * - Q_TRACE_EXIT(tracepoint, args...)
+ * Fires 'tracepoint' if it is enabled when the current scope exists.
+ *
+ * - Q_TRACE_SCOPE(tracepoint, args...)
+ * Wrapper around Q_TRACE/_EXIT to trace entry and exit. First it traces
+ * `${tracepoint}_entry` and then `${tracepoint}_exit` on scope exit.
+ *
* - Q_UNCONDITIONAL_TRACE(tracepoint, args...)
* Fires 'tracepoint' unconditionally: no check is performed to query
* whether 'tracepoint' is enabled.
@@ -110,15 +117,23 @@
*/
#include <QtCore/qglobal.h>
+#include <QtCore/qscopeguard.h>
QT_BEGIN_NAMESPACE
#if defined(Q_TRACEPOINT) && !defined(QT_BOOTSTRAPPED)
# define Q_TRACE(x, ...) QtPrivate::trace_ ## x(__VA_ARGS__)
+# define Q_TRACE_EXIT(x, ...) \
+ const auto qTraceExit_ ## x ## __COUNTER__ = qScopeGuard([&]() { Q_TRACE(x, __VA_ARGS__); });
+# define Q_TRACE_SCOPE(x, ...) \
+ Q_TRACE(x ## _entry, __VA_ARGS__); \
+ Q_TRACE_EXIT(x ## _exit, __VA_ARGS__);
# define Q_UNCONDITIONAL_TRACE(x, ...) QtPrivate::do_trace_ ## x(__VA_ARGS__)
# define Q_TRACE_ENABLED(x) QtPrivate::trace_ ## x ## _enabled()
#else
# define Q_TRACE(x, ...)
+# define Q_TRACE_EXIT(x, ...)
+# define Q_TRACE_SCOPE(x, ...)
# define Q_UNCONDITIONAL_TRACE(x, ...)
# define Q_TRACE_ENABLED(x) false
#endif // defined(Q_TRACEPOINT) && !defined(QT_BOOTSTRAPPED)
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index 1809861fc6..c2c3b2702b 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -86,15 +86,6 @@ static void appendOrganizationAndApp(QString &path) // Courtesy qstandardpaths_u
#endif
}
-static inline QString displayName(QStandardPaths::StandardLocation type)
-{
-#ifndef QT_BOOTSTRAPPED
- return QStandardPaths::displayName(type);
-#else
- return QString::number(type);
-#endif
-}
-
static inline void appendTestMode(QString &path)
{
if (QStandardPaths::isTestModeEnabled())
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 2250f91dc3..30994d3056 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -778,7 +778,7 @@ QCoreApplication::QCoreApplication(int &argc, char **argv
void QCoreApplicationPrivate::init()
{
- Q_TRACE(QCoreApplicationPrivate_init_entry);
+ Q_TRACE_SCOPE(QCoreApplicationPrivate_init);
#if defined(Q_OS_MACOS)
QMacAutoReleasePool pool;
@@ -883,8 +883,6 @@ void QCoreApplicationPrivate::init()
#ifndef QT_NO_QOBJECT
is_app_running = true; // No longer starting up.
#endif
-
- Q_TRACE(QCoreApplicationPrivate_init_exit);
}
/*!
@@ -1199,7 +1197,7 @@ bool QCoreApplicationPrivate::notify_helper(QObject *receiver, QEvent * event)
{
// Note: when adjusting the tracepoints in here
// consider adjusting QApplicationPrivate::notify_helper too.
- Q_TRACE(QCoreApplication_notify_entry, receiver, event, event->type());
+ Q_TRACE_SCOPE(QCoreApplication_notify, receiver, event, event->type());
// send to all application event filters (only does anything in the main thread)
if (QCoreApplication::self
@@ -1498,7 +1496,7 @@ bool QCoreApplication::sendSpontaneousEvent(QObject *receiver, QEvent *event)
*/
void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority)
{
- Q_TRACE(QCoreApplication_postEvent_entry, receiver, event, event->type());
+ Q_TRACE_SCOPE(QCoreApplication_postEvent, receiver, event, event->type());
if (receiver == 0) {
qWarning("QCoreApplication::postEvent: Unexpected null receiver");
diff --git a/src/corelib/qtcore.tracepoints b/src/corelib/qtcore.tracepoints
index 33734a4274..3a70136741 100644
--- a/src/corelib/qtcore.tracepoints
+++ b/src/corelib/qtcore.tracepoints
@@ -1,3 +1,9 @@
+{
+QT_BEGIN_NAMESPACE
+class QEvent;
+QT_END_NAMESPACE
+}
+
QCoreApplicationPrivate_init_entry()
QCoreApplicationPrivate_init_exit()
@@ -10,6 +16,7 @@ QEvent_ctor(QEvent *event, int type)
QEvent_dtor(QEvent *event, int type)
QCoreApplication_postEvent_entry(QObject *receiver, QEvent *event, int type)
+QCoreApplication_postEvent_exit(QObject *receiver, QEvent *event, int type)
QCoreApplication_postEvent_event_compressed(QObject *receiver, QEvent *event)
QCoreApplication_postEvent_event_posted(QObject *receiver, QEvent *event, int type)
@@ -17,6 +24,7 @@ QCoreApplication_sendEvent(QObject *receiver, QEvent *event, int type)
QCoreApplication_sendSpontaneousEvent(QObject *receiver, QEvent *event, int type)
QCoreApplication_notify_entry(QObject *receiver, QEvent *event, int type)
+QCoreApplication_notify_exit(QObject *receiver, QEvent *event, int type)
QCoreApplication_notify_event_filtered(QObject *receiver, QEvent *event, int type)
QCoreApplication_notify_before_delivery(QObject *receiver, QEvent *event, int type)
QCoreApplication_notify_after_delivery(QObject *receiver, QEvent *event, int type, bool consumed)
@@ -32,3 +40,5 @@ QMetaObject_activate_begin_slot_functor(void *slotObject)
QMetaObject_activate_end_slot_functor(void *slotObject)
QMetaObject_activate_begin_declarative_signal(QObject *sender, int signalIndex)
QMetaObject_activate_end_declarative_signal(QObject *sender, int signalIndex)
+
+qt_message_print(int type, const char *category, const char *function, const char *file, int line, const QString &message)
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 9d6e0cbdd8..a123aa8e75 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -501,7 +501,11 @@ bool qt_is_ascii(const char *&ptr, const char *end) Q_DECL_NOTHROW
while (ptr + 4 <= end) {
quint32 data = qFromUnaligned<quint32>(ptr);
if (data &= 0x80808080U) {
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ uint idx = qCountLeadingZeroBits(data);
+#else
uint idx = qCountTrailingZeroBits(data);
+#endif
ptr += idx / 8;
return false;
}
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 140196004b..1c269213e2 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -231,8 +231,8 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
if (screen_gamma != 0.0 && file_gamma != 0.0)
png_set_gamma(png_ptr, 1.0f / screen_gamma, file_gamma);
- png_uint_32 width;
- png_uint_32 height;
+ png_uint_32 width = 0;
+ png_uint_32 height = 0;
int bit_depth = 0;
int color_type = 0;
png_bytep trans_alpha = 0;
@@ -240,7 +240,7 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal
int num_trans;
png_colorp palette = 0;
int num_palette;
- int interlace_method;
+ int interlace_method = PNG_INTERLACE_LAST;
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_method, 0, 0);
png_set_interlace_handling(png_ptr);
@@ -689,7 +689,7 @@ bool QPngHandlerPrivate::readPngImage(QImage *outImage)
QImage::Format QPngHandlerPrivate::readImageFormat()
{
QImage::Format format = QImage::Format_Invalid;
- png_uint_32 width, height;
+ png_uint_32 width = 0, height = 0;
int bit_depth = 0, color_type = 0;
png_colorp palette;
int num_palette;
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 4e0c45d8ae..3a93b09941 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1425,7 +1425,7 @@ void QGuiApplicationPrivate::eventDispatcherReady()
void QGuiApplicationPrivate::init()
{
- Q_TRACE(QGuiApplicationPrivate_init_entry);
+ Q_TRACE_SCOPE(QGuiApplicationPrivate_init);
#if defined(Q_OS_MACOS)
QMacAutoReleasePool pool;
@@ -1589,8 +1589,6 @@ void QGuiApplicationPrivate::init()
if (!QGuiApplicationPrivate::displayName)
QObject::connect(q, &QGuiApplication::applicationNameChanged,
q, &QGuiApplication::applicationDisplayNameChanged);
-
- Q_TRACE(QGuiApplicationPrivate_init_exit);
}
extern void qt_cleanupFontDatabase();
@@ -1834,7 +1832,7 @@ bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArra
void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
{
- Q_TRACE(QGuiApplicationPrivate_processWindowSystemEvent_entry, e->type);
+ Q_TRACE_SCOPE(QGuiApplicationPrivate_processWindowSystemEvent, e->type);
switch(e->type) {
case QWindowSystemInterfacePrivate::Mouse:
@@ -1944,8 +1942,6 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
qWarning() << "Unknown user input event type:" << e->type;
break;
}
-
- Q_TRACE(QGuiApplicationPrivate_processWindowSystemEvent_exit, e->type);
}
/*! \internal
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index ed575abf54..f56be55325 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -1378,10 +1378,8 @@ QGradient::QGradient(Preset preset)
}();
const QJsonValue presetData = jsonPresets[preset - 1];
- if (!presetData.isObject()) {
- qWarning("QGradient: Undefined preset %i", preset);
+ if (!presetData.isObject())
return;
- }
m_type = LinearGradient;
setCoordinateMode(ObjectMode);
diff --git a/src/gui/qtgui.tracepoints b/src/gui/qtgui.tracepoints
index aed6c35c03..0a96a589b1 100644
--- a/src/gui/qtgui.tracepoints
+++ b/src/gui/qtgui.tracepoints
@@ -1,3 +1,9 @@
+{
+QT_BEGIN_NAMESPACE
+class QImageReader;
+QT_END_NAMESPACE
+}
+
QGuiApplicationPrivate_init_entry()
QGuiApplicationPrivate_init_exit()
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 1b17759b5f..ba441a1921 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -569,12 +569,10 @@ public:
bool isFileSystem() const { return (m_attributes & SFGAO_FILESYSTEM) != 0; }
bool isDir() const { return (m_attributes & SFGAO_FOLDER) != 0; }
- // Copy using IFileOperation
- bool canCopy() const { return (m_attributes & SFGAO_CANCOPY) != 0; }
// Supports IStream
bool canStream() const { return (m_attributes & SFGAO_STREAM) != 0; }
- bool copyData(QIODevice *out);
+ bool copyData(QIODevice *out, QString *errorMessage);
static IShellItems itemsFromItemArray(IShellItemArray *items);
@@ -666,14 +664,19 @@ QWindowsShellItem::IShellItems QWindowsShellItem::itemsFromItemArray(IShellItemA
return result;
}
-bool QWindowsShellItem::copyData(QIODevice *out)
+bool QWindowsShellItem::copyData(QIODevice *out, QString *errorMessage)
{
- if (!canCopy() || !canStream())
+ if (!canStream()) {
+ *errorMessage = QLatin1String("Item not streamable");
return false;
+ }
IStream *istream = nullptr;
HRESULT hr = m_item->BindToHandler(nullptr, BHID_Stream, IID_PPV_ARGS(&istream));
- if (FAILED(hr))
+ if (FAILED(hr)) {
+ *errorMessage = QLatin1String("BindToHandler() failed: ")
+ + QLatin1String(QWindowsContext::comErrorString(hr));
return false;
+ }
enum : ULONG { bufSize = 102400 };
char buffer[bufSize];
ULONG bytesRead;
@@ -686,7 +689,12 @@ bool QWindowsShellItem::copyData(QIODevice *out)
break;
}
istream->Release();
- return hr == S_OK || hr == S_FALSE;
+ if (hr != S_OK && hr != S_FALSE) {
+ *errorMessage = QLatin1String("Read() failed: ")
+ + QLatin1String(QWindowsContext::comErrorString(hr));
+ return false;
+ }
+ return true;
}
// Helper for "Libraries": collections of folders appearing from Windows 7
@@ -735,8 +743,6 @@ void QWindowsShellItem::format(QDebug &d) const
d << " [dir]";
if (canStream())
d << " [stream]";
- if (canCopy())
- d << " [copyable]";
d << ", normalDisplay=\"" << normalDisplay()
<< "\", desktopAbsoluteParsing=\"" << desktopAbsoluteParsing()
<< "\", urlString=\"" << urlString() << "\", fileSysPath=\"" << fileSysPath() << '"';
@@ -1395,21 +1401,50 @@ static void cleanupTemporaryItemCopies()
QFile::remove(file);
}
-static QString createTemporaryItemCopy(QWindowsShellItem &qItem)
+// Determine temporary file pattern from a shell item's display
+// name. This can be a URL.
+
+static bool validFileNameCharacter(QChar c)
{
- if (!qItem.canCopy() || !qItem.canStream())
+ return c.isLetterOrNumber() || c == QLatin1Char('_') || c == QLatin1Char('-');
+}
+
+QString tempFilePattern(QString name)
+{
+ const int lastSlash = qMax(name.lastIndexOf(QLatin1Char('/')),
+ name.lastIndexOf(QLatin1Char('\\')));
+ if (lastSlash != -1)
+ name.remove(0, lastSlash + 1);
+
+ int lastDot = name.lastIndexOf(QLatin1Char('.'));
+ if (lastDot < 0)
+ lastDot = name.size();
+ name.insert(lastDot, QStringLiteral("_XXXXXX"));
+
+ for (int i = lastDot - 1; i >= 0; --i) {
+ if (!validFileNameCharacter(name.at(i)))
+ name[i] = QLatin1Char('_');
+ }
+
+ name.prepend(QDir::tempPath() + QLatin1Char('/'));
+ return name;
+}
+
+static QString createTemporaryItemCopy(QWindowsShellItem &qItem, QString *errorMessage)
+{
+ if (!qItem.canStream()) {
+ *errorMessage = QLatin1String("Item not streamable");
return QString();
- QString pattern = qItem.normalDisplay();
- const int lastDot = pattern.lastIndexOf(QLatin1Char('.'));
- const QString placeHolder = QStringLiteral("_XXXXXX");
- if (lastDot >= 0)
- pattern.insert(lastDot, placeHolder);
- else
- pattern.append(placeHolder);
-
- QTemporaryFile targetFile(QDir::tempPath() + QLatin1Char('/') + pattern);
+ }
+
+ QTemporaryFile targetFile(tempFilePattern(qItem.normalDisplay()));
targetFile.setAutoRemove(false);
- if (!targetFile.open() || !qItem.copyData(&targetFile))
+ if (!targetFile.open()) {
+ *errorMessage = QLatin1String("Cannot create temporary file: ")
+ + targetFile.errorString();
+ return QString();
+ }
+ if (!qItem.copyData(&targetFile, errorMessage))
return QString();
const QString result = targetFile.fileName();
if (temporaryItemCopies()->isEmpty())
@@ -1427,11 +1462,14 @@ QList<QUrl> QWindowsNativeOpenFileDialog::dialogResult() const
QWindowsShellItem qItem(item);
const QString path = qItem.path();
if (path.isEmpty() && !qItem.isDir()) {
- const QString temporaryCopy = createTemporaryItemCopy(qItem);
- if (temporaryCopy.isEmpty())
- qWarning() << "Unable to create a local copy of" << qItem;
- else
+ QString errorMessage;
+ const QString temporaryCopy = createTemporaryItemCopy(qItem, &errorMessage);
+ if (temporaryCopy.isEmpty()) {
+ qWarning().noquote() << "Unable to create a local copy of" << qItem
+ << ": " << errorMessage;
+ } else {
result.append(QUrl::fromLocalFile(temporaryCopy));
+ }
} else {
result.append(qItem.url());
}
diff --git a/src/tools/tracegen/etw.cpp b/src/tools/tracegen/etw.cpp
index 8c065f93c9..e839137915 100644
--- a/src/tools/tracegen/etw.cpp
+++ b/src/tools/tracegen/etw.cpp
@@ -110,19 +110,21 @@ static QString createGuid(const QUuid &uuid)
return guid;
}
-static void writePrologue(QTextStream &stream, const QString &fileName, const QString &providerName)
+static void writePrologue(QTextStream &stream, const QString &fileName, const Provider &provider)
{
- QUuid uuid = QUuid::createUuidV5(QUuid(), providerName.toLocal8Bit());
+ QUuid uuid = QUuid::createUuidV5(QUuid(), provider.name.toLocal8Bit());
- const QString provider = providerVar(providerName);
+ const QString providerV = providerVar(provider.name);
const QString guard = includeGuard(fileName);
const QString guid = createGuid(uuid);
const QString guidString = uuid.toString();
stream << "#ifndef " << guard << "\n"
<< "#define " << guard << "\n"
+ << "\n"
<< "#include <windows.h>\n"
- << "#include <TraceLoggingProvider.h>\n";
+ << "#include <TraceLoggingProvider.h>\n"
+ << "\n";
/* TraceLogging API macros cannot deal with UTF8
* source files, so we work around it like this
@@ -132,30 +134,33 @@ static void writePrologue(QTextStream &stream, const QString &fileName, const QS
"#define _TlgPragmaUtf8Begin\n"
"#define _TlgPragmaUtf8End\n";
+ stream << "\n";
stream << qtHeaders();
-
stream << "\n";
+ if (!provider.prefixText.isEmpty())
+ stream << provider.prefixText.join(QLatin1Char('\n')) << "\n\n";
+
stream << "#ifdef TRACEPOINT_DEFINE\n"
<< "/* " << guidString << " */\n"
- << "TRACELOGGING_DEFINE_PROVIDER(" << provider << ", \""
- << providerName <<"\", " << guid << ");\n\n";
+ << "TRACELOGGING_DEFINE_PROVIDER(" << providerV << ", \""
+ << provider.name <<"\", " << guid << ");\n\n";
stream << "static inline void registerProvider()\n"
<< "{\n"
- << " TraceLoggingRegister(" << provider << ");\n"
+ << " TraceLoggingRegister(" << providerV << ");\n"
<< "}\n\n";
stream << "static inline void unregisterProvider()\n"
<< "{\n"
- << " TraceLoggingUnregister(" << provider << ");\n"
+ << " TraceLoggingUnregister(" << providerV << ");\n"
<< "}\n";
stream << "Q_CONSTRUCTOR_FUNCTION(registerProvider)\n"
<< "Q_DESTRUCTOR_FUNCTION(unregisterProvider)\n\n";
stream << "#else\n"
- << "TRACELOGGING_DECLARE_PROVIDER(" << provider << ");\n"
+ << "TRACELOGGING_DECLARE_PROVIDER(" << providerV << ");\n"
<< "#endif // TRACEPOINT_DEFINE\n\n";
}
@@ -224,7 +229,7 @@ void writeEtw(QFile &file, const Provider &provider)
const QString fileName = QFileInfo(file.fileName()).fileName();
- writePrologue(stream, fileName, provider.name);
+ writePrologue(stream, fileName, provider);
writeTracepoints(stream, provider);
writeEpilogue(stream, fileName);
}
diff --git a/src/tools/tracegen/lttng.cpp b/src/tools/tracegen/lttng.cpp
index 5d41bf5f1f..f0fbca9e16 100644
--- a/src/tools/tracegen/lttng.cpp
+++ b/src/tools/tracegen/lttng.cpp
@@ -104,16 +104,21 @@ static void writeCtfMacro(QTextStream &stream, const Tracepoint::Field &field)
}
}
-static void writePrologue(QTextStream &stream, const QString &fileName, const QString &providerName)
+static void writePrologue(QTextStream &stream, const QString &fileName, const Provider &provider)
{
+ const QString guard = includeGuard(fileName);
+
stream << "#undef TRACEPOINT_PROVIDER\n";
- stream << "#define TRACEPOINT_PROVIDER " << providerName << "\n\n";
+ stream << "#define TRACEPOINT_PROVIDER " << provider.name << "\n";
+ stream << "\n";
+ // include prefix text or qt headers only once
+ stream << "#if !defined(" << guard << ")\n";
stream << qtHeaders();
-
- const QString guard = includeGuard(fileName);
-
stream << "\n";
+ if (!provider.prefixText.isEmpty())
+ stream << provider.prefixText.join(QLatin1Char('\n')) << "\n\n";
+ stream << "#endif\n\n";
/* the first guard is the usual one, the second is required
* by LTTNG to force the re-evaluation of TRACEPOINT_* macros
@@ -213,7 +218,7 @@ void writeLttng(QFile &file, const Provider &provider)
const QString fileName = QFileInfo(file.fileName()).fileName();
- writePrologue(stream, fileName, provider.name);
+ writePrologue(stream, fileName, provider);
writeTracepoints(stream, provider);
writeEpilogue(stream, fileName);
}
diff --git a/src/tools/tracegen/provider.cpp b/src/tools/tracegen/provider.cpp
index a6523a2e3d..39633efe5d 100644
--- a/src/tools/tracegen/provider.cpp
+++ b/src/tools/tracegen/provider.cpp
@@ -275,9 +275,21 @@ Provider parseProvider(const QString &filename)
Provider provider;
provider.name = QFileInfo(filename).baseName();
+ bool parsingPrefixText = false;
for (int lineNumber = 1; !s.atEnd(); ++lineNumber) {
QString line = s.readLine().trimmed();
+ if (line == QLatin1String("{")) {
+ parsingPrefixText = true;
+ continue;
+ } else if (parsingPrefixText && line == QLatin1String("}")) {
+ parsingPrefixText = false;
+ continue;
+ } else if (parsingPrefixText) {
+ provider.prefixText.append(line);
+ continue;
+ }
+
if (line.isEmpty() || line.startsWith(QLatin1Char('#')))
continue;
@@ -296,7 +308,14 @@ Provider parseProvider(const QString &filename)
}
}
+ if (parsingPrefixText) {
+ panic("Syntax error while processing '%s': "
+ "no closing brace found for prefix text block",
+ qPrintable(filename));
+ }
+
#ifdef TRACEGEN_DEBUG
+ qDebug() << provider.prefixText;
for (auto i = provider.tracepoints.constBegin(); i != provider.tracepoints.constEnd(); ++i)
dumpTracepoint(*i);
#endif
diff --git a/src/tools/tracegen/provider.h b/src/tools/tracegen/provider.h
index 9771e62f4d..9be0c33d89 100644
--- a/src/tools/tracegen/provider.h
+++ b/src/tools/tracegen/provider.h
@@ -86,6 +86,7 @@ struct Provider
{
QString name;
QVector<Tracepoint> tracepoints;
+ QStringList prefixText;
};
Provider parseProvider(const QString &filename);
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 7c44bfe39d..0ab9ed6ec2 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -3700,7 +3700,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
// to the ones in QCoreApplicationPrivate::notify_helper; the reason for their
// duplication is because tracepoint symbols are not exported by QtCore.
// If you adjust the tracepoints here, consider adjusting QCoreApplicationPrivate too.
- Q_TRACE(QApplication_notify_entry, receiver, e, e->type());
+ Q_TRACE_SCOPE(QApplication_notify, receiver, e, e->type());
// send to all application event filters
if (threadRequiresCoreApplication()
diff --git a/src/widgets/qtwidgets.tracepoints b/src/widgets/qtwidgets.tracepoints
index 01a1383670..9c40cdb3e7 100644
--- a/src/widgets/qtwidgets.tracepoints
+++ b/src/widgets/qtwidgets.tracepoints
@@ -1,4 +1,11 @@
+{
+QT_BEGIN_NAMESPACE
+class QEvent;
+QT_END_NAMESPACE
+}
+
QApplication_notify_entry(QObject *receiver, QEvent *event, int type)
+QApplication_notify_exit(QObject *receiver, QEvent *event, int type)
QApplication_notify_event_filtered(QObject *receiver, QEvent *event, int type)
QApplication_notify_before_delivery(QObject *receiver, QEvent *event, int type)
QApplication_notify_after_delivery(QObject *receiver, QEvent *event, int type, bool consumed)
diff --git a/tests/auto/network/kernel/qhostinfo/BLACKLIST b/tests/auto/network/kernel/qhostinfo/BLACKLIST
index cd4d4eb03c..87c5fe991f 100644
--- a/tests/auto/network/kernel/qhostinfo/BLACKLIST
+++ b/tests/auto/network/kernel/qhostinfo/BLACKLIST
@@ -4,5 +4,3 @@
windows ci
[blockingLookup:a-plus-aaaa]
windows ci
-[reverseLookup:google-public-dns-a.google.com]
-ci
diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
index 82825f608c..0a130d363e 100644
--- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
@@ -396,6 +396,68 @@ void tst_QHostInfo::lookupConnectToLambda()
QCOMPARE(tmp.join(' '), expected.join(' '));
}
+static QStringList reverseLookupHelper(const QString &ip)
+{
+ QStringList results;
+
+ const QString pythonCode =
+ "import socket;"
+ "import sys;"
+ "print (socket.getnameinfo((sys.argv[1], 0), 0)[0]);";
+
+ QList<QByteArray> lines;
+ QProcess python;
+ python.setProcessChannelMode(QProcess::ForwardedErrorChannel);
+ python.start("python", QStringList() << QString("-c") << pythonCode << ip);
+ if (python.waitForFinished()) {
+ if (python.exitStatus() == QProcess::NormalExit && python.exitCode() == 0)
+ lines = python.readAllStandardOutput().split('\n');
+ for (QByteArray line : lines) {
+ if (!line.isEmpty())
+ results << line.trimmed();
+ }
+ if (!results.isEmpty())
+ return results;
+ }
+
+ qDebug() << "Python failed, falling back to nslookup";
+ QProcess lookup;
+ lookup.setProcessChannelMode(QProcess::ForwardedErrorChannel);
+ lookup.start("nslookup", QStringList(ip));
+ if (!lookup.waitForFinished()) {
+ results << "nslookup failure";
+ qDebug() << "nslookup failure";
+ return results;
+ }
+ lines = lookup.readAllStandardOutput().split('\n');
+
+ QByteArray name;
+
+ const QByteArray nameMarkerNix("name =");
+ const QByteArray nameMarkerWin("Name:");
+ const QByteArray addressMarkerWin("Address:");
+
+ for (QByteArray line : lines) {
+ int index = -1;
+ if ((index = line.indexOf(nameMarkerNix)) != -1) { // Linux and macOS
+ name = line.mid(index + nameMarkerNix.length()).chopped(1).trimmed();
+ results << name;
+ } else if (line.startsWith(nameMarkerWin)) { // Windows formatting
+ name = line.mid(line.lastIndexOf(" ")).trimmed();
+ } else if (line.startsWith(addressMarkerWin)) {
+ QByteArray address = line.mid(addressMarkerWin.length()).trimmed();
+ if (address == ip) {
+ results << name;
+ }
+ }
+ }
+
+ if (results.isEmpty()) {
+ qDebug() << "Failure to parse nslookup output: " << lines;
+ }
+ return results;
+}
+
void tst_QHostInfo::reverseLookup_data()
{
QTest::addColumn<QString>("address");
@@ -403,8 +465,8 @@ void tst_QHostInfo::reverseLookup_data()
QTest::addColumn<int>("err");
QTest::addColumn<bool>("ipv6");
- QTest::newRow("google-public-dns-a.google.com") << QString("8.8.8.8") << QStringList(QString("google-public-dns-a.google.com")) << 0 << false;
- QTest::newRow("gitorious.org") << QString("87.238.52.168") << QStringList(QString("gitorious.org")) << 0 << false;
+ QTest::newRow("dns.google") << QString("8.8.8.8") << reverseLookupHelper("8.8.8.8") << 0 << false;
+ QTest::newRow("one.one.one.one") << QString("1.1.1.1") << reverseLookupHelper("1.1.1.1") << 0 << false;
QTest::newRow("bogus-name") << QString("1::2::3::4") << QStringList() << 1 << true;
}
@@ -422,6 +484,8 @@ void tst_QHostInfo::reverseLookup()
QHostInfo info = QHostInfo::fromName(address);
if (err == 0) {
+ if (!hostNames.contains(info.hostName()))
+ qDebug() << "Failure: expecting" << hostNames << ",got " << info.hostName();
QVERIFY(hostNames.contains(info.hostName()));
QCOMPARE(info.addresses().first(), QHostAddress(address));
} else {
diff --git a/tests/manual/dialogs/filedialogpanel.cpp b/tests/manual/dialogs/filedialogpanel.cpp
index 800baae45e..25c1e44b8c 100644
--- a/tests/manual/dialogs/filedialogpanel.cpp
+++ b/tests/manual/dialogs/filedialogpanel.cpp
@@ -505,8 +505,15 @@ void FileDialogPanel::accepted()
Q_ASSERT(d);
m_result.clear();
QDebug(&m_result).nospace()
+#if QT_VERSION >= 0x050000
+ << "URLs: " << d->selectedUrls() << '\n'
+#endif
<< "Files: " << d->selectedFiles()
- << "\nDirectory: " << d->directory().absolutePath()
+ << "\nDirectory: "
+#if QT_VERSION >= 0x050000
+ << d->directoryUrl() << ", "
+#endif
+ << d->directory().absolutePath()
<< "\nName filter: " << d->selectedNameFilter();
QTimer::singleShot(0, this, SLOT(showAcceptedResult())); // Avoid problems with the closing (modal) dialog as parent.
}