summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qcore_unix.cpp8
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp10
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h2
-rw-r--r--src/corelib/kernel/qeventdispatcher_blackberry.cpp14
-rw-r--r--src/corelib/kernel/qmetatype.h10
-rw-r--r--src/corelib/kernel/qobject.cpp2
-rw-r--r--src/corelib/kernel/qtcore_eval.cpp83
-rw-r--r--src/corelib/kernel/qvariant_p.h2
8 files changed, 65 insertions, 66 deletions
diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp
index 98e697eb57..e4181b5c86 100644
--- a/src/corelib/kernel/qcore_unix.cpp
+++ b/src/corelib/kernel/qcore_unix.cpp
@@ -63,12 +63,8 @@ QT_BEGIN_NAMESPACE
static inline bool time_update(struct timespec *tv, const struct timespec &start,
const struct timespec &timeout)
{
- if (!QElapsedTimer::isMonotonic()) {
- // we cannot recalculate the timeout without a monotonic clock as the time may have changed
- return false;
- }
-
- // clock source is monotonic, so we can recalculate how much timeout is left
+ // clock source is (hopefully) monotonic, so we can recalculate how much timeout is left;
+ // if it isn't monotonic, we'll simply hope that it hasn't jumped, because we have no alternative
struct timespec now = qt_gettime();
*tv = timeout + start - now;
return tv->tv_sec >= 0;
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index c9f4ab23ec..386ee9cbda 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -381,7 +381,7 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint
, origArgc(aargc)
, origArgv(new char *[aargc])
#endif
- , application_type(0)
+ , application_type(QCoreApplicationPrivate::Tty)
#ifndef QT_NO_QOBJECT
, in_exec(false)
, aboutToQuitEmitted(false)
@@ -724,7 +724,7 @@ void QCoreApplication::init()
#endif
#ifdef QT_EVAL
- extern void qt_core_eval_init(uint);
+ extern void qt_core_eval_init(QCoreApplicationPrivate::Type);
qt_core_eval_init(d->application_type);
#endif
@@ -1451,7 +1451,7 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type
// first, we diddle the event so that we can deliver
// it, and that no one will try to touch it later.
pe.event->posted = false;
- QScopedPointer<QEvent> e(pe.event);
+ QEvent *e = pe.event;
QObject * r = pe.receiver;
--r->d_func()->postedEvents;
@@ -1469,8 +1469,10 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type
};
MutexUnlocker unlocker(locker);
+ QScopedPointer<QEvent> event_deleter(e); // will delete the event (with the mutex unlocked)
+
// after all that work, it's time to deliver the event.
- QCoreApplication::sendEvent(r, e.data());
+ QCoreApplication::sendEvent(r, e);
// careful when adding anything below this point - the
// sendEvent() call might invalidate any invariants this
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index 563a3b2093..6a3bea9c9e 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -135,7 +135,7 @@ public:
static bool isTranslatorInstalled(QTranslator *translator);
#endif
- uint application_type;
+ QCoreApplicationPrivate::Type application_type;
QString cachedApplicationDirPath;
QString cachedApplicationFilePath;
diff --git a/src/corelib/kernel/qeventdispatcher_blackberry.cpp b/src/corelib/kernel/qeventdispatcher_blackberry.cpp
index 4cf1db18b4..d9e38b68b2 100644
--- a/src/corelib/kernel/qeventdispatcher_blackberry.cpp
+++ b/src/corelib/kernel/qeventdispatcher_blackberry.cpp
@@ -43,6 +43,7 @@
#include "qsocketnotifier.h"
#include "qdebug.h"
#include "qelapsedtimer.h"
+#include "private/qthread_p.h"
#include <bps/bps.h>
#include <bps/event.h>
@@ -352,11 +353,16 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef
}
}
- // Wait for event or file to be ready
event = 0;
- const int result = bps_get_event(&event, timeoutLeft);
- if (Q_UNLIKELY(result != BPS_SUCCESS))
- qWarning("QEventDispatcherBlackberry bps_get_event failed");
+ { // We need to increase loop level in this scope,
+ // because bps_get_event can also invoke callbacks
+ QScopedLoopLevelCounter loopLevelCounter(d->threadData);
+
+ // Wait for event or file to be ready
+ const int result = bps_get_event(&event, timeoutLeft);
+ if (Q_UNLIKELY(result != BPS_SUCCESS))
+ qWarning("QEventDispatcherBlackberry: bps_get_event failed");
+ }
if (!event) // In case of !event, we break out of the loop to let Qt process the timers
break; // (since timeout has expired) and socket notifiers that are now ready.
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 35cb589843..005199080d 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -1582,7 +1582,7 @@ int qRegisterNormalizedMetaType(const QT_PREPEND_NAMESPACE(QByteArray) &normaliz
QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Create,
QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Destruct,
QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Construct,
- sizeof(T),
+ int(sizeof(T)),
flags,
QtPrivate::MetaObjectForType<T>::value());
@@ -1753,8 +1753,8 @@ struct QMetaTypeId< SINGLE_ARG_TEMPLATE<T> > \
Q_ASSERT(tName); \
const int tNameLen = qstrlen(tName); \
QByteArray typeName; \
- typeName.reserve(sizeof(#SINGLE_ARG_TEMPLATE) + 1 + tNameLen + 1 + 1); \
- typeName.append(#SINGLE_ARG_TEMPLATE, sizeof(#SINGLE_ARG_TEMPLATE) - 1) \
+ typeName.reserve(int(sizeof(#SINGLE_ARG_TEMPLATE)) + 1 + tNameLen + 1 + 1); \
+ typeName.append(#SINGLE_ARG_TEMPLATE, int(sizeof(#SINGLE_ARG_TEMPLATE)) - 1) \
.append('<').append(tName, tNameLen); \
if (typeName.endsWith('>')) \
typeName.append(' '); \
@@ -1786,8 +1786,8 @@ struct QMetaTypeId< DOUBLE_ARG_TEMPLATE<T, U> > \
const int tNameLen = qstrlen(tName); \
const int uNameLen = qstrlen(uName); \
QByteArray typeName; \
- typeName.reserve(sizeof(#DOUBLE_ARG_TEMPLATE) + 1 + tNameLen + 1 + uNameLen + 1 + 1); \
- typeName.append(#DOUBLE_ARG_TEMPLATE, sizeof(#DOUBLE_ARG_TEMPLATE) - 1) \
+ typeName.reserve(int(sizeof(#DOUBLE_ARG_TEMPLATE)) + 1 + tNameLen + 1 + uNameLen + 1 + 1); \
+ typeName.append(#DOUBLE_ARG_TEMPLATE, int(sizeof(#DOUBLE_ARG_TEMPLATE)) - 1) \
.append('<').append(tName, tNameLen).append(',').append(uName, uNameLen); \
if (typeName.endsWith('>')) \
typeName.append(' '); \
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 495ce7c948..997a65169d 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -3921,7 +3921,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) {
they have additional features accessible through the \l
{Meta-Object System}.
- \snippet code/src_corelib_kernel_qobject.cpp 36
+ \snippet code/doc_src_properties.cpp 0
The property name and type and the \c READ function are required.
The type can be any type supported by QVariant, or it can be a
diff --git a/src/corelib/kernel/qtcore_eval.cpp b/src/corelib/kernel/qtcore_eval.cpp
index e9ff786074..59656883f1 100644
--- a/src/corelib/kernel/qtcore_eval.cpp
+++ b/src/corelib/kernel/qtcore_eval.cpp
@@ -44,6 +44,7 @@
#include <qlibraryinfo.h>
#include <qobject.h>
#include <qcoreapplication.h>
+#include <private/qcoreapplication_p.h>
#include "stdio.h"
#include "stdlib.h"
@@ -52,7 +53,7 @@ QT_BEGIN_NAMESPACE
#include "qconfig_eval.cpp"
-static const char boilerplate_unsuported[] =
+static const char boilerplate_supported_but_time_limited[] =
"\nQt %1 Evaluation License\n"
"Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).\n"
"This trial version may only be used for evaluation purposes\n"
@@ -86,13 +87,19 @@ static const char will_shutdown_now[] =
"timeout and will shut down.\n"
"Contact http://qt.digia.com/contact-us for pricing and purchasing information.\n";
-static int qt_eval_is_supported()
+enum EvaluationStatus {
+ EvaluationNotSupported = 0,
+ EvaluationSupportedButTimeLimited,
+ EvaluationSupported
+};
+
+static EvaluationStatus qt_eval_is_supported()
{
const volatile char *const license_key = qt_eval_key_data + 12;
// fast fail
if (!qt_eval_key_data[0] || !*license_key)
- return -1;
+ return EvaluationNotSupported;
// is this an unsupported evaluation?
const volatile char *typecode = license_key;
@@ -103,31 +110,33 @@ static int qt_eval_is_supported()
if (!field && typecode[1] == '4' && typecode[2] == 'M') {
if (typecode[0] == 'Q')
- return 0;
+ return EvaluationSupportedButTimeLimited;
else if (typecode[0] == 'R' || typecode[0] == 'Z')
- return 1;
+ return EvaluationSupported;
}
- return -1;
+ return EvaluationNotSupported;
}
static int qt_eval_days_left()
{
- if (qt_eval_is_supported() < 0)
- return -2;
-
QDate today = QDate::currentDate();
QDate build = QLibraryInfo::buildDate();
return qMax<qint64>(-1, today.daysTo(build) + 30);
}
+static bool qt_eval_is_expired()
+{
+ return qt_eval_days_left() < 0;
+}
+
static QString qt_eval_string()
{
const char *msg;
switch (qt_eval_is_supported()) {
- case 0:
- msg = boilerplate_unsuported;
+ case EvaluationSupportedButTimeLimited:
+ msg = boilerplate_supported_but_time_limited;
break;
- case 1:
+ case EvaluationSupported:
msg = boilerplate_supported;
break;
default:
@@ -153,7 +162,7 @@ public:
QCoreFuriCuri() : QObject(), warn(-1), kill(-1)
{
- if (!qt_eval_is_supported()) {
+ if (qt_eval_is_supported() == EvaluationSupportedButTimeLimited) {
warn = startTimer(WARN_TIMEOUT);
kill = 0;
}
@@ -173,27 +182,20 @@ public:
#if defined(QT_BUILD_CORE_LIB) || defined (QT_BOOTSTRAPPED)
-void qt_core_eval_init(uint type)
+void qt_core_eval_init(QCoreApplicationPrivate::Type type)
{
- if (!type)
- return; // GUI app
+ if (type != QCoreApplicationPrivate::Tty)
+ return;
- switch (qt_eval_days_left()) {
- case -2:
+ if (!qt_eval_is_supported())
return;
- case -1:
+ if (qt_eval_is_expired()) {
fprintf(stderr, "%s\n", boilerplate_expired);
- if (type == 0) {
- // if we're a console app only.
- exit(0);
- }
-
- default:
+ exit(0);
+ } else {
fprintf(stderr, "%s\n", qPrintable(qt_eval_string()));
- if (type == 0) {
- Q_UNUSED(new QCoreFuriCuri());
- }
+ Q_UNUSED(new QCoreFuriCuri());
}
}
#endif
@@ -453,12 +455,7 @@ public:
{
setWindowTitle(QLatin1String(" "));
- QString str = qt_eval_string();
- if (expired) {
- str = QLatin1String(boilerplate_expired);
- } else {
- str = qt_eval_string();
- }
+ QString str = expired ? QLatin1String(boilerplate_expired) : qt_eval_string();
str = str.trimmed();
QFrame *border = new QFrame(this);
@@ -520,24 +517,22 @@ public:
};
-void qt_gui_eval_init(uint)
+void qt_gui_eval_init(QCoreApplicationPrivate::Type type)
{
- switch (qt_eval_days_left()) {
- case -2:
+ Q_UNUSED(type);
+
+ if (!qt_eval_is_supported())
return;
- case -1: {
+ if (qt_eval_is_expired()) {
EvalMessageBox box(true);
box.exec();
::exit(0);
- }
-
- default: {
+ } else {
EvalMessageBox *box = new EvalMessageBox(false);
box->show();
Q_UNUSED(new QGuiFuriCuri());
}
- }
}
static QString qt_eval_title_prefix()
@@ -547,14 +542,14 @@ static QString qt_eval_title_prefix()
QString qt_eval_adapt_window_title(const QString &title)
{
- if (qt_eval_days_left() == -2)
+ if (!qt_eval_is_supported())
return title;
return qt_eval_title_prefix() + title;
}
void qt_eval_init_widget(QWidget *w)
{
- if (qt_eval_days_left() == -2)
+ if (!qt_eval_is_supported())
return;
if (w->isTopLevel() && w->windowTitle().isEmpty() && w->windowType() != Qt::Desktop ) {
w->setWindowTitle(QLatin1String(" "));
diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h
index 04b9d92f55..4ec049e20d 100644
--- a/src/corelib/kernel/qvariant_p.h
+++ b/src/corelib/kernel/qvariant_p.h
@@ -224,7 +224,7 @@ class QVariantIsNull
public:
static const bool Value = (sizeof(test<T>(0)) == sizeof(Yes));
};
-#elif defined(Q_CC_MSVC) && _MSC_VER >= 1400 // MSVC 2005, 2008 version: no decltype, but 'sealed' classes (>=2010 has decltype)
+#elif defined(Q_CC_MSVC) && _MSC_VER >= 1400 && !defined(Q_CC_INTEL) // MSVC 2005, 2008 version: no decltype, but 'sealed' classes (>=2010 has decltype)
template<typename T>
class HasIsNullMethod {
struct Yes { char unused[1]; };