summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp6
-rw-r--r--src/corelib/kernel/qcoreapplication_win.cpp17
-rw-r--r--src/corelib/kernel/qmetatype.cpp33
-rw-r--r--src/corelib/kernel/qmetatype_p.h2
-rw-r--r--src/corelib/kernel/qvariant.cpp22
-rw-r--r--src/corelib/kernel/qvariant.h1
6 files changed, 32 insertions, 49 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 95c80cad20..5d70c4c5d8 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1082,6 +1082,12 @@ void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority)
if (event->type() == QEvent::DeferredDelete && data == QThreadData::current()) {
// remember the current running eventloop for DeferredDelete
// events posted in the receiver's thread
+
+ // check that QEvent's d pointer is unused before we store the loop level
+ // if further updates to QEvent have made the use of the d pointer necessary,
+ // then update this code to store the loop level somewhere else
+ Q_ASSERT_X(event->d == 0, "QCoreApplication::postEvent",
+ "Internal error: this code relies on QEvent::d being null");
event->d = reinterpret_cast<QEventPrivate *>(quintptr(data->loopLevel));
}
diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp
index 7cc1f0e286..5649a8dd76 100644
--- a/src/corelib/kernel/qcoreapplication_win.cpp
+++ b/src/corelib/kernel/qcoreapplication_win.cpp
@@ -141,29 +141,28 @@ public:
};
// defined in qlogging.cpp
-extern Q_CORE_EXPORT QByteArray qMessageFormatString(QtMsgType type,
- const QMessageLogContext &context,
- const char *str);
+extern Q_CORE_EXPORT QString qMessageFormatString(QtMsgType type,
+ const QMessageLogContext &context,
+ const QString &str);
-Q_CORE_EXPORT void qWinMessageHandler(QtMsgType t, const QMessageLogContext &context, const char *str)
+Q_CORE_EXPORT void qWinMessageHandler(QtMsgType t, const QMessageLogContext &context, const QString &str)
{
// cannot use QMutex here, because qWarning()s in the QMutex
// implementation may cause this function to recurse
static QWinMsgHandlerCriticalSection staticCriticalSection;
- QByteArray message = qMessageFormatString(t, context, str);
- QString s(QString::fromLocal8Bit(message));
+ QString message = qMessageFormatString(t, context, str);
// OutputDebugString is not threadsafe.
staticCriticalSection.lock();
- OutputDebugString((wchar_t*)s.utf16());
+ OutputDebugString((wchar_t*)message.utf16());
staticCriticalSection.unlock();
}
Q_CORE_EXPORT void qWinMsgHandler(QtMsgType t, const char *str)
{
QMessageLogContext emptyContext;
- qWinMessageHandler(t, emptyContext, str);
+ qWinMessageHandler(t, emptyContext, QString::fromLocal8Bit(str));
}
/*****************************************************************************
@@ -189,7 +188,7 @@ void qWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam,
usingWinMain = true;
// Install default debug handler
- qInstallMsgHandler(qWinMsgHandler);
+ qInstallMessageHandler(qWinMessageHandler);
// Create command line
argv = qWinCmdLine<char>(cmdParam, int(strlen(cmdParam)), argc);
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 809d3bf589..2756dd5241 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -82,7 +82,7 @@ namespace {
struct DefinedTypesFilter {
template<typename T>
struct Acceptor {
- static const bool IsAccepted = QtMetaTypePrivate::TypeDefinition<T>::IsAvailable && QTypeModuleInfo<T>::IsCore;
+ static const bool IsAccepted = QtMetaTypePrivate::TypeDefinition<T>::IsAvailable && QModulesPrivate::QTypeModuleInfo<T>::IsCore;
};
};
} // namespace
@@ -1109,11 +1109,11 @@ class TypeCreator {
struct CreatorImpl<T, /* IsAcceptedType = */ false> {
static void *Create(const int type, const void *copy)
{
- if (QTypeModuleInfo<T>::IsGui) {
+ if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) {
if (Q_LIKELY(qMetaTypeGuiHelper))
return qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].creator(copy);
}
- if (QTypeModuleInfo<T>::IsWidget) {
+ if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) {
if (Q_LIKELY(qMetaTypeWidgetsHelper))
return qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].creator(copy);
}
@@ -1171,12 +1171,12 @@ class TypeDestroyer {
struct DestroyerImpl<T, /* IsAcceptedType = */ false> {
static void Destroy(const int type, void *where)
{
- if (QTypeModuleInfo<T>::IsGui) {
+ if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) {
if (Q_LIKELY(qMetaTypeGuiHelper))
qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].deleter(where);
return;
}
- if (QTypeModuleInfo<T>::IsWidget) {
+ if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) {
if (Q_LIKELY(qMetaTypeWidgetsHelper))
qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].deleter(where);
return;
@@ -1237,10 +1237,10 @@ class TypeConstructor {
struct ConstructorImpl<T, /* IsAcceptedType = */ false> {
static void *Construct(const int type, void *where, const void *copy)
{
- if (QTypeModuleInfo<T>::IsGui)
+ if (QModulesPrivate::QTypeModuleInfo<T>::IsGui)
return Q_LIKELY(qMetaTypeGuiHelper) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].constructor(where, copy) : 0;
- if (QTypeModuleInfo<T>::IsWidget)
+ if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget)
return Q_LIKELY(qMetaTypeWidgetsHelper) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].constructor(where, copy) : 0;
// This point can be reached only for known types that definition is not available, for example
@@ -1325,12 +1325,12 @@ class TypeDestructor {
struct DestructorImpl<T, /* IsAcceptedType = */ false> {
static void Destruct(const int type, void *where)
{
- if (QTypeModuleInfo<T>::IsGui) {
+ if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) {
if (Q_LIKELY(qMetaTypeGuiHelper))
qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].destructor(where);
return;
}
- if (QTypeModuleInfo<T>::IsWidget) {
+ if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) {
if (Q_LIKELY(qMetaTypeWidgetsHelper))
qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].destructor(where);
return;
@@ -1398,10 +1398,10 @@ class SizeOf {
struct SizeOfImpl<T, /* IsAcceptedType = */ false> {
static int Size(const int type)
{
- if (QTypeModuleInfo<T>::IsGui)
+ if (QModulesPrivate::QTypeModuleInfo<T>::IsGui)
return Q_LIKELY(qMetaTypeGuiHelper) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].size : 0;
- if (QTypeModuleInfo<T>::IsWidget)
+ if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget)
return Q_LIKELY(qMetaTypeWidgetsHelper) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].size : 0;
// This point can be reached only for known types that definition is not available, for example
@@ -1466,10 +1466,10 @@ class Flags
{
static quint32 Flags(const int type)
{
- if (QTypeModuleInfo<T>::IsGui)
+ if (QModulesPrivate::QTypeModuleInfo<T>::IsGui)
return Q_LIKELY(qMetaTypeGuiHelper) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].flags : 0;
- if (QTypeModuleInfo<T>::IsWidget)
+ if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget)
return Q_LIKELY(qMetaTypeWidgetsHelper) ? qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].flags : 0;
// This point can be reached only for known types that definition is not available, for example
@@ -1649,12 +1649,12 @@ class TypeInfo {
{
TypeInfoImpl(const uint type, QMetaTypeInterface &info)
{
- if (QTypeModuleInfo<T>::IsGui) {
+ if (QModulesPrivate::QTypeModuleInfo<T>::IsGui) {
if (Q_LIKELY(qMetaTypeGuiHelper))
info = qMetaTypeGuiHelper[type - QMetaType::FirstGuiType];
return;
}
- if (QTypeModuleInfo<T>::IsWidget) {
+ if (QModulesPrivate::QTypeModuleInfo<T>::IsWidget) {
if (Q_LIKELY(qMetaTypeWidgetsHelper))
info = qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType];
return;
@@ -1671,7 +1671,6 @@ public:
}
template<typename T>
void delegate(const T*) { TypeInfoImpl<T>(m_type, info); }
- void delegate(const void*) {}
void delegate(const QMetaTypeSwitcher::UnknownType*) {}
void delegate(const QMetaTypeSwitcher::NotBuiltinType*) { customTypeInfo(m_type); }
private:
@@ -1693,7 +1692,7 @@ QMetaType QMetaType::typeInfo(const int type)
{
TypeInfo typeInfo(type);
QMetaTypeSwitcher::switcher<void>(typeInfo, type, 0);
- return typeInfo.info.creator || type == Void ? QMetaType(QMetaType::NoExtensionFlags
+ return typeInfo.info.creator ? QMetaType(QMetaType::NoExtensionFlags
, static_cast<const QMetaTypeInterface *>(0) // typeInfo::info is a temporary variable, we can't return address of it.
, typeInfo.info.creator
, typeInfo.info.deleter
diff --git a/src/corelib/kernel/qmetatype_p.h b/src/corelib/kernel/qmetatype_p.h
index 985cf71974..b593489963 100644
--- a/src/corelib/kernel/qmetatype_p.h
+++ b/src/corelib/kernel/qmetatype_p.h
@@ -70,7 +70,6 @@ static inline int moduleForType(const uint typeId)
return Widgets;
return Unknown;
}
-}
template <typename T>
class QTypeModuleInfo
@@ -114,6 +113,7 @@ QT_FOR_EACH_STATIC_CORE_CLASS(QT_DECLARE_CORE_MODULE_TYPES_ITER)
QT_FOR_EACH_STATIC_CORE_TEMPLATE(QT_DECLARE_CORE_MODULE_TYPES_ITER)
QT_FOR_EACH_STATIC_GUI_CLASS(QT_DECLARE_GUI_MODULE_TYPES_ITER)
QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_DECLARE_WIDGETS_MODULE_TYPES_ITER)
+} // namespace QModulesPrivate
#undef QT_DECLARE_CORE_MODULE_TYPES_ITER
#undef QT_DECLARE_GUI_MODULE_TYPES_ITER
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 768678c6c9..83d48d9330 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -103,7 +103,7 @@ namespace {
struct CoreTypesFilter {
template<typename T>
struct Acceptor {
- static const bool IsAccepted = QTypeModuleInfo<T>::IsCore && QtMetaTypePrivate::TypeDefinition<T>::IsAvailable;
+ static const bool IsAccepted = QModulesPrivate::QTypeModuleInfo<T>::IsCore && QtMetaTypePrivate::TypeDefinition<T>::IsAvailable;
};
};
} // annonymous
@@ -1353,19 +1353,6 @@ QVariant::QVariant(const char *val)
Constructs a new variant with the regular expression value \a re.
*/
-/*! \since 4.2
- \fn QVariant::QVariant(Qt::GlobalColor color)
-
- Constructs a new variant of type QVariant::Color and initializes
- it with \a color.
-
- This is a convenience constructor that allows \c{QVariant(Qt::blue);}
- to create a valid QVariant storing a QColor.
-
- Note: This constructor will assert if the application does not link
- to the Qt GUI library.
- */
-
QVariant::QVariant(Type type)
{ create(type, 0); }
QVariant::QVariant(int typeId, const void *copy)
@@ -1447,7 +1434,6 @@ QVariant::QVariant(const QRegExp &regExp) { d.is_null = false; d.type = RegExp;
QVariant::QVariant(const QRegularExpression &re) { d.is_null = false; d.type = QMetaType::QRegularExpression; v_construct<QRegularExpression>(&d, re); }
#endif // QT_BOOTSTRAPPED
#endif // QT_NO_REGEXP
-QVariant::QVariant(Qt::GlobalColor color) { create(62, &color); }
/*!
Returns the storage type of the value stored in the variant.
@@ -1586,9 +1572,6 @@ void QVariant::clear()
*/
const char *QVariant::typeToName(int typeId)
{
- if (typeId == Invalid)
- return 0;
-
return QMetaType::typeName(typeId);
}
@@ -1602,9 +1585,6 @@ const char *QVariant::typeToName(int typeId)
*/
QVariant::Type QVariant::nameToType(const char *name)
{
- if (!name || !*name)
- return Invalid;
-
int metaType = QMetaType::type(name);
return metaType <= int(UserType) ? QVariant::Type(metaType) : UserType;
}
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index fb0e059f45..cd8ac9823d 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -248,7 +248,6 @@ class Q_CORE_EXPORT QVariant
QVariant(const QUrl &url);
QVariant(const QEasingCurve &easing);
#endif
- QVariant(Qt::GlobalColor color);
QVariant& operator=(const QVariant &other);
#ifdef Q_COMPILER_RVALUE_REFS