summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-12-14 17:42:19 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-12-14 17:42:25 (GMT)
commit463cd4f6563dc12d8b45bf2e293dc64d583e132c (patch)
tree1d1a6123f42fe8843f32c572cd3d1c4fb42aefcd /src/corelib/kernel
parent4879551f72a377e0816164ce1762eb646839f4a6 (diff)
parent0295f8da10d6c920511d09f9e506b8bed8c444c3 (diff)
downloadQt-463cd4f6563dc12d8b45bf2e293dc64d583e132c.zip
Qt-463cd4f6563dc12d8b45bf2e293dc64d583e132c.tar.gz
Qt-463cd4f6563dc12d8b45bf2e293dc64d583e132c.tar.bz2
Merge commit oslo-staging-2/4.6 into upstream/4.6
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qobject.cpp6
-rw-r--r--src/corelib/kernel/qobject_p.h11
-rw-r--r--src/corelib/kernel/qvariant.h2
3 files changed, 10 insertions, 9 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 30cd011..85915c2 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -145,7 +145,7 @@ QObjectPrivate::QObjectPrivate(int version)
receiveChildEvents = true;
postedEvents = 0;
extraData = 0;
- connectedSignals = 0;
+ connectedSignals[0] = connectedSignals[1] = 0;
inEventHandler = false;
inThreadChangeEvent = false;
deleteWatch = 0;
@@ -2924,9 +2924,9 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index,
QObjectPrivate *const sender_d = QObjectPrivate::get(s);
if (signal_index < 0) {
- sender_d->connectedSignals = ~ulong(0);
+ sender_d->connectedSignals[0] = sender_d->connectedSignals[1] = ~0;
} else if (signal_index < (int)sizeof(sender_d->connectedSignals) * 8) {
- sender_d->connectedSignals |= ulong(1) << signal_index;
+ sender_d->connectedSignals[signal_index >> 5] |= (1 << (signal_index & 0x1f));
}
return true;
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
index f899c78..d1841be 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -172,7 +172,7 @@ public:
}
int signalIndex(const char *signalName) const;
- inline bool isSignalConnected(int signalIdx) const;
+ inline bool isSignalConnected(uint signalIdx) const;
public:
QString objectName;
@@ -183,7 +183,7 @@ public:
Connection *senders; // linked list of connections connected to this object
Sender *currentSender; // object currently activating the object
- mutable ulong connectedSignals;
+ mutable quint32 connectedSignals[2];
#ifdef QT3_SUPPORT
QList<QObject *> pendingChildInsertedEvents;
@@ -205,6 +205,7 @@ public:
int *deleteWatch;
};
+
/*! \internal
Returns true if the signal with index \a signal_index from object \a sender is connected.
@@ -213,12 +214,12 @@ public:
\a signal_index must be the index returned by QObjectPrivate::signalIndex;
*/
-inline bool QObjectPrivate::isSignalConnected(int signal_index) const
+inline bool QObjectPrivate::isSignalConnected(uint signal_index) const
{
- return signal_index >= (int)sizeof(connectedSignals) * 8
+ return signal_index >= sizeof(connectedSignals) * 8
|| qt_signal_spy_callback_set.signal_begin_callback
|| qt_signal_spy_callback_set.signal_end_callback
- || (connectedSignals & (ulong(1) << signal_index));
+ || (connectedSignals[signal_index >> 5] & (1 << (signal_index & 0x1f)));
}
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 3c10788..74ff17f 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -458,7 +458,7 @@ inline void qVariantSetValue(QVariant &v, const T &t)
//if possible we reuse the current QVariant private
const uint type = qMetaTypeId<T>(reinterpret_cast<T *>(0));
QVariant::Private &d = v.data_ptr();
- if (v.isDetached() && (type <= uint(QVariant::Char) || type == d.type)) {
+ if (v.isDetached() && (type == d.type || (type <= uint(QVariant::Char) && d.type <= uint(QVariant::Char)))) {
d.type = type;
d.is_null = false;
T *old = reinterpret_cast<T*>(d.is_shared ? d.data.shared->ptr : &d.data.ptr);