summaryrefslogtreecommitdiffstats
path: root/src/kernel/qobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/qobject.cpp')
-rw-r--r--src/kernel/qobject.cpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/kernel/qobject.cpp b/src/kernel/qobject.cpp
index 5c78c17bc..62ea618b9 100644
--- a/src/kernel/qobject.cpp
+++ b/src/kernel/qobject.cpp
@@ -769,6 +769,9 @@ TQObject::~TQObject()
while( (c=cit.current()) ) { // for each connected slot...
++cit;
if ( (obj=c->object()) ) {
+#ifdef TQT_THREAD_SUPPORT
+ TQMutexLocker locker( obj->senderObjects->listMutex );
+#endif // TQT_THREAD_SUPPORT
removeObjFromList( obj->senderObjects, this );
}
}
@@ -2494,25 +2497,23 @@ bool TQObject::disconnectInternal( const TQObject *sender, int signal_index,
c = clist->first();
while ( c ) { // for all receivers...
if ( r == 0 ) { // remove all receivers
+ if (c->object()->senderObjects) {
#ifdef TQT_THREAD_SUPPORT
- if (c->object()->senderObjects) c->object()->senderObjects->listMutex->lock();
-#endif // TQT_THREAD_SUPPORT
- removeObjFromList( c->object()->senderObjects, s );
-#ifdef TQT_THREAD_SUPPORT
- if (c->object()->senderObjects) c->object()->senderObjects->listMutex->unlock();
+ TQMutexLocker locker(c->object()->senderObjects->listMutex);
#endif // TQT_THREAD_SUPPORT
+ removeObjFromList( c->object()->senderObjects, s );
+ }
success = TRUE;
c = clist->next();
} else if ( r == c->object() &&
( (member_index == -1) ||
((member_index == c->member()) && (c->memberType() == membcode)) ) ) {
+ if (c->object()->senderObjects) {
#ifdef TQT_THREAD_SUPPORT
- if (c->object()->senderObjects) c->object()->senderObjects->listMutex->lock();
-#endif // TQT_THREAD_SUPPORT
- removeObjFromList( c->object()->senderObjects, s, TRUE );
-#ifdef TQT_THREAD_SUPPORT
- if (c->object()->senderObjects) c->object()->senderObjects->listMutex->unlock();
+ TQMutexLocker locker(c->object()->senderObjects->listMutex);
#endif // TQT_THREAD_SUPPORT
+ removeObjFromList( c->object()->senderObjects, s, TRUE );
+ }
success = TRUE;
clist->remove();
c = clist->current();
@@ -2531,25 +2532,23 @@ bool TQObject::disconnectInternal( const TQObject *sender, int signal_index,
c = clist->first();
while ( c ) { // for all receivers...
if ( r == 0 ) { // remove all receivers
+ if (c->object()->senderObjects) {
#ifdef TQT_THREAD_SUPPORT
- if (c->object()->senderObjects) c->object()->senderObjects->listMutex->lock();
-#endif // TQT_THREAD_SUPPORT
- removeObjFromList( c->object()->senderObjects, s, TRUE );
-#ifdef TQT_THREAD_SUPPORT
- if (c->object()->senderObjects) c->object()->senderObjects->listMutex->unlock();
+ TQMutexLocker locker(c->object()->senderObjects->listMutex);
#endif // TQT_THREAD_SUPPORT
+ removeObjFromList( c->object()->senderObjects, s, TRUE );
+ }
success = TRUE;
c = clist->next();
} else if ( r == c->object() &&
( (member_index == -1) ||
((member_index == c->member()) && (c->memberType() == membcode)) ) ) {
+ if (c->object()->senderObjects) {
#ifdef TQT_THREAD_SUPPORT
- if (c->object()->senderObjects) c->object()->senderObjects->listMutex->lock();
-#endif // TQT_THREAD_SUPPORT
- removeObjFromList( c->object()->senderObjects, s, TRUE );
-#ifdef TQT_THREAD_SUPPORT
- if (c->object()->senderObjects) c->object()->senderObjects->listMutex->unlock();
+ TQMutexLocker locker(c->object()->senderObjects->listMutex);
#endif // TQT_THREAD_SUPPORT
+ removeObjFromList( c->object()->senderObjects, s, TRUE );
+ }
success = TRUE;
clist->remove();
c = clist->current();