summaryrefslogtreecommitdiffstats
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
parente980c0380f96c0eea185e86a464f140b012e2818 (diff)
downloadtqt3-68f557434a089b4eecd682397cc63bcd26a259f7.tar.gz
tqt3-68f557434a089b4eecd682397cc63bcd26a259f7.zip
Automated update from Qt3
-rw-r--r--src/kernel/ntqobject.h1
-rw-r--r--src/kernel/qobject.cpp36
2 files changed, 31 insertions, 6 deletions
diff --git a/src/kernel/ntqobject.h b/src/kernel/ntqobject.h
index 943e8319c..781697ceb 100644
--- a/src/kernel/ntqobject.h
+++ b/src/kernel/ntqobject.h
@@ -226,6 +226,7 @@ public:
#ifdef QT_THREAD_SUPPORT
TQThread* contextThreadObject() const;
void moveToThread(TQThread *targetThread);
+ void disableThreadPostedEvents(bool disable);
#endif
private:
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 {