summaryrefslogtreecommitdiffstats
path: root/src/kernel/qobject.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2013-05-02 17:03:49 -0500
committerTimothy Pearson <[email protected]>2013-05-02 17:03:49 -0500
commit68f557434a089b4eecd682397cc63bcd26a259f7 (patch)
tree880cce703d8c2ad405a4db4c25f33177d62960b2 /src/kernel/qobject.cpp
parente980c0380f96c0eea185e86a464f140b012e2818 (diff)
downloadtqt3-68f557434a089b4eecd682397cc63bcd26a259f7.tar.gz
tqt3-68f557434a089b4eecd682397cc63bcd26a259f7.zip
Automated update from Qt3
Diffstat (limited to 'src/kernel/qobject.cpp')
-rw-r--r--src/kernel/qobject.cpp36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/kernel/qobject.cpp b/src/kernel/qobject.cpp
index 16c9b23e9..2e3843761 100644
--- a/src/kernel/qobject.cpp
+++ b/src/kernel/qobject.cpp
@@ -66,9 +66,14 @@ class TQObjectPrivate {
{
public:
#ifndef QT_NO_USERDATA
- TQObjectPrivate( uint s ) : TQPtrVector<TQObjectUserData>(s){ setAutoDelete( TRUE ); }
+ TQObjectPrivate( uint s ) : TQPtrVector<TQObjectUserData>(s) {
+ ownThread = NULL;
+ disableThreadPostedEvents = false;
+ setAutoDelete( TRUE );
+ }
#endif
TQThread* ownThread;
+ bool disableThreadPostedEvents;
};
#if defined(QT_THREAD_SUPPORT)
@@ -151,6 +156,25 @@ void TQObject::moveToThread(TQThread *targetThread)
setThreadObject_helper(targetThread);
}
+/*!
+ Changes the way cross thread signals are handled
+ If disable is FALSE, signals emitted from one thread will be
+ posted to any other connected threads' event loops (default).
+
+ If disable is TRUE, calls to emit from one thread
+ will immediately execute slots in another thread.
+ This mode of operation is inherently unsafe and is provided
+ solely to support thread management by a third party application.
+ */
+void TQObject::disableThreadPostedEvents(bool disable) {
+ if ( !d ) {
+ d = new TQObjectPrivate(0);
+ }
+
+ d->ownThread = TQThread::currentThreadObject();
+ d->disableThreadPostedEvents = disable;
+}
+
#endif
class TQSenderObjectList : public TQObjectList, public TQShared
@@ -957,7 +981,7 @@ bool TQObject::event( TQEvent *e )
{
TQMetaCallEvent* metaEvent = dynamic_cast<TQMetaCallEvent*>(e);
if (metaEvent) {
- if (d->ownThread == TQThread::currentThreadObject()) {
+ if ((d->disableThreadPostedEvents) || (d->ownThread == TQThread::currentThreadObject())) {
TQSenderObjectList* sol;
TQObject* oldSender = 0;
sol = senderObjects;
@@ -2592,7 +2616,7 @@ void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o )
sol->currentSender = this;
}
if ( c->memberType() == TQSIGNAL_CODE ) {
- if (object->d->ownThread == currentThread) {
+ if ((d->disableThreadPostedEvents) || (object->d->ownThread == currentThread)) {
object->tqt_emit( c->member(), o );
}
else {
@@ -2602,7 +2626,7 @@ void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o )
}
}
else {
- if (object->d->ownThread == currentThread) {
+ if ((d->disableThreadPostedEvents) || (object->d->ownThread == currentThread)) {
object->tqt_invoke( c->member(), o );
}
else {
@@ -2632,7 +2656,7 @@ void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o )
sol->currentSender = this;
}
if ( c->memberType() == TQSIGNAL_CODE ) {
- if (object->d->ownThread == currentThread) {
+ if ((d->disableThreadPostedEvents) || (object->d->ownThread == currentThread)) {
object->tqt_emit( c->member(), o );
}
else {
@@ -2642,7 +2666,7 @@ void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o )
}
}
else {
- if (object->d->ownThread == currentThread) {
+ if ((d->disableThreadPostedEvents) || (object->d->ownThread == currentThread)) {
object->tqt_invoke( c->member(), o );
}
else {