diff options
Diffstat (limited to 'src/kernel/qobject.cpp')
-rw-r--r-- | src/kernel/qobject.cpp | 162 |
1 files changed, 81 insertions, 81 deletions
diff --git a/src/kernel/qobject.cpp b/src/kernel/qobject.cpp index 607a035..b48531e 100644 --- a/src/kernel/qobject.cpp +++ b/src/kernel/qobject.cpp @@ -52,7 +52,7 @@ // QStyleControlElementData #include "qstyle.h" -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT #include "qmutex.h" #include <private/qmutexpool_p.h> #include "qthread.h" @@ -130,16 +130,16 @@ QStyleControlElementDataPrivate* QObject::controlElementDataPrivateObject() { return d->controlElementDataPrivate; } -#if defined(TQT_THREAD_SUPPORT) +#if defined(QT_THREAD_SUPPORT) void QObject::moveToThread_helper(QThread *targetThread) { QEvent e(QEvent::ThreadChange); QApplication::sendEvent(this, &e); -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT QMutexLocker locker( d->childObjectListMutex ); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT if (childObjects) { QObject *child; @@ -155,9 +155,9 @@ void QObject::setThreadObject_helper(QThread *targetThread) { d->ownThread = targetThread; -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT QMutexLocker locker( d->childObjectListMutex ); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT if (childObjects) { QObject *child; @@ -185,9 +185,9 @@ void QObject::setThreadObject_helper(QThread *targetThread) */ void QObject::moveToThread(QThread *targetThread) { -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT QMutexLocker locker( QApplication::qt_mutex ); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT if (parentObj) { #if defined(QT_DEBUG) @@ -491,7 +491,7 @@ void *qt_find_obj_child( QObject *parent, const char *type, const char *name ) return 0; } -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT /*! Returns a pointer to the QThread* associated with @@ -530,12 +530,12 @@ static void qt_spy_signal( QObject* sender, int signal, QUObject* o ) s.sprintf( "%s_%s", mo->className(), sigData->name ); int slot = qt_preliminary_signal_spy->metaObject()->findSlot( s, TRUE ); if ( slot >= 0 ) { -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT // protect access to qt_spy_signal_sender void * const address = &qt_spy_signal_sender; QMutexLocker locker( qt_global_mutexpool ? qt_global_mutexpool->get( address ) : 0 ); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT QObject* old_sender = qt_spy_signal_sender; qt_spy_signal_sender = sender; @@ -554,7 +554,7 @@ static void qt_spy_signal( QObject* sender, int signal, QUObject* o ) static QObjectList* object_trees = 0; -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT static QMutex *obj_trees_mutex = 0; #endif @@ -562,7 +562,7 @@ static void cleanup_object_trees() { delete object_trees; object_trees = 0; -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT delete obj_trees_mutex; obj_trees_mutex = 0; #endif @@ -576,7 +576,7 @@ static void ensure_object_trees() static void insert_tree( QObject* obj ) { -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT if ( !obj_trees_mutex ) obj_trees_mutex = new QMutex(); QMutexLocker locker( obj_trees_mutex ); @@ -589,7 +589,7 @@ static void insert_tree( QObject* obj ) static void remove_tree( QObject* obj ) { if ( object_trees ) { -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT QMutexLocker locker( obj_trees_mutex ); #endif object_trees->removeRef( obj ); @@ -780,10 +780,10 @@ QObject::~QObject() delete childObjects; } -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT delete d->childObjectListMutex; delete d->senderObjectListMutex; -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT delete d; } @@ -1079,17 +1079,17 @@ bool QObject::event( QEvent *e ) QSenderObjectList* sol; QObject* oldSender = 0; sol = senderObjects; -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT sol->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT if ( sol ) { oldSender = sol->currentSender; sol->ref(); sol->currentSender = metaEvent->sender(); } -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT sol->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT QUObject *o = metaEvent->data(); if (metaEvent->type() == QMetaCallEvent::MetaCallEmit) { qt_emit( metaEvent->id(), o ); @@ -1097,9 +1097,9 @@ bool QObject::event( QEvent *e ) if (metaEvent->type() == QMetaCallEvent::MetaCallInvoke) { qt_invoke( metaEvent->id(), o ); } -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT sol->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT if (sol ) { sol->currentSender = oldSender; if ( sol->deref() ) { @@ -1108,9 +1108,9 @@ bool QObject::event( QEvent *e ) sol = NULL; } } -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT if (sol) sol->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT } else { qWarning("QObject: Ignoring metacall event from non-owning thread"); @@ -1617,9 +1617,9 @@ QConnectionList *QObject::receivers( int signal ) const void QObject::insertChild( QObject *obj ) { -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT QMutexLocker locker( d->childObjectListMutex ); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT if ( obj->isTree ) { remove_tree( obj ); @@ -1663,9 +1663,9 @@ void QObject::insertChild( QObject *obj ) void QObject::removeChild( QObject *obj ) { -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT QMutexLocker locker( d->childObjectListMutex ); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT if ( childObjects && childObjects->removeRef(obj) ) { obj->parentObj = 0; @@ -1903,12 +1903,12 @@ const QObject *QObject::sender() { #ifndef QT_NO_PRELIMINARY_SIGNAL_SPY if ( this == qt_preliminary_signal_spy ) { -# ifdef TQT_THREAD_SUPPORT +# ifdef QT_THREAD_SUPPORT // protect access to qt_spy_signal_sender void * const address = &qt_spy_signal_sender; QMutexLocker locker( qt_global_mutexpool ? qt_global_mutexpool->get( address ) : 0 ); -# endif // TQT_THREAD_SUPPORT +# endif // QT_THREAD_SUPPORT return qt_spy_signal_sender; } #endif @@ -2252,24 +2252,24 @@ void QObject::connectInternal( const QObject *sender, int signal_index, const QO Q_CHECK_PTR( c ); clist->append( c ); if ( !r->senderObjects ) { // create list of senders -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT r->d->senderObjectListMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT r->senderObjects = new QSenderObjectList; -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT r->senderObjects->listMutex->lock(); r->d->senderObjectListMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT } else { -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT r->senderObjects->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT } r->senderObjects->append( s ); // add sender to list -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT r->senderObjects->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT } @@ -2475,25 +2475,25 @@ bool QObject::disconnectInternal( const QObject *sender, int signal_index, c = clist->first(); while ( c ) { // for all receivers... if ( r == 0 ) { // remove all receivers -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT if (c->object()->senderObjects) c->object()->senderObjects->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT removeObjFromList( c->object()->senderObjects, s ); -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT if (c->object()->senderObjects) c->object()->senderObjects->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT success = TRUE; c = clist->next(); } else if ( r == c->object() && ( (member_index == -1) || ((member_index == c->member()) && (c->memberType() == membcode)) ) ) { -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT if (c->object()->senderObjects) c->object()->senderObjects->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT removeObjFromList( c->object()->senderObjects, s, TRUE ); -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT if (c->object()->senderObjects) c->object()->senderObjects->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT success = TRUE; clist->remove(); c = clist->current(); @@ -2512,25 +2512,25 @@ bool QObject::disconnectInternal( const QObject *sender, int signal_index, c = clist->first(); while ( c ) { // for all receivers... if ( r == 0 ) { // remove all receivers -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT if (c->object()->senderObjects) c->object()->senderObjects->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT removeObjFromList( c->object()->senderObjects, s, TRUE ); -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT if (c->object()->senderObjects) c->object()->senderObjects->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT success = TRUE; c = clist->next(); } else if ( r == c->object() && ( (member_index == -1) || ((member_index == c->member()) && (c->memberType() == membcode)) ) ) { -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT if (c->object()->senderObjects) c->object()->senderObjects->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT removeObjFromList( c->object()->senderObjects, s, TRUE ); -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT if (c->object()->senderObjects) c->object()->senderObjects->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT success = TRUE; clist->remove(); c = clist->current(); @@ -2772,9 +2772,9 @@ void QObject::activate_signal( QConnectionList *clist, QUObject *o ) c = clist->first(); object = c->object(); sol = object->senderObjects; -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT sol->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT if ( sol ) { oldSender = sol->currentSender; sol->ref(); @@ -2785,13 +2785,13 @@ void QObject::activate_signal( QConnectionList *clist, QUObject *o ) (object->d->disableThreadPostedEvents) || (currentThread && currentThread->threadPostedEventsDisabled()) || (currentThread && object->d->ownThread == currentThread)) { -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT sol->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT object->qt_emit( c->member(), o ); -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT sol->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT } else { if (object->d->ownThread && !object->d->ownThread->finished()) { @@ -2807,13 +2807,13 @@ void QObject::activate_signal( QConnectionList *clist, QUObject *o ) (object->d->disableThreadPostedEvents) || (currentThread && currentThread->threadPostedEventsDisabled()) || (currentThread && object->d->ownThread == currentThread)) { -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT sol->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT object->qt_invoke( c->member(), o ); -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT sol->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT } else { if (object->d->ownThread && !object->d->ownThread->finished()) { @@ -2832,9 +2832,9 @@ void QObject::activate_signal( QConnectionList *clist, QUObject *o ) sol = NULL; } } -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT if (sol) sol->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT } else { QConnection *cd = 0; QConnectionListIt it(*clist); @@ -2845,9 +2845,9 @@ void QObject::activate_signal( QConnectionList *clist, QUObject *o ) cd = c; object = c->object(); sol = object->senderObjects; -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT sol->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT if ( sol ) { oldSender = sol->currentSender; sol->ref(); @@ -2858,13 +2858,13 @@ void QObject::activate_signal( QConnectionList *clist, QUObject *o ) (object->d->disableThreadPostedEvents) || (currentThread && currentThread->threadPostedEventsDisabled()) || (currentThread && object->d->ownThread == currentThread)) { -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT sol->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT object->qt_emit( c->member(), o ); -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT sol->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT } else { if (object->d->ownThread && !object->d->ownThread->finished()) { @@ -2880,13 +2880,13 @@ void QObject::activate_signal( QConnectionList *clist, QUObject *o ) (object->d->disableThreadPostedEvents) || (currentThread && currentThread->threadPostedEventsDisabled()) || (currentThread && object->d->ownThread == currentThread)) { -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT sol->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT object->qt_invoke( c->member(), o ); -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT sol->listMutex->lock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT } else { if (object->d->ownThread && !object->d->ownThread->finished()) { @@ -2905,9 +2905,9 @@ void QObject::activate_signal( QConnectionList *clist, QUObject *o ) sol = NULL; } } -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT if (sol) sol->listMutex->unlock(); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT } } } @@ -3046,9 +3046,9 @@ void QObject::dumpObjectTree() void QObject::dumpObjectInfo() { -#ifdef TQT_THREAD_SUPPORT +#ifdef QT_THREAD_SUPPORT QMutexLocker locker( d->senderObjectListMutex ); -#endif // TQT_THREAD_SUPPORT +#endif // QT_THREAD_SUPPORT #if defined(QT_DEBUG) qDebug( "OBJECT %s::%s", className(), name( "unnamed" ) ); |