diff options
author | Alexander Golubev <fatzer2@gmail.com> | 2024-03-16 08:14:54 +0300 |
---|---|---|
committer | Alexander Golubev <fatzer2@gmail.com> | 2024-03-16 08:14:54 +0300 |
commit | 6250349b0b0a48a23b6cd847e70330e90c812bcc (patch) | |
tree | e376dcf0d886faafcf95eb5454c3ecd7ca2943b1 /src/kernel/ntqsignalslotimp.h | |
parent | 24eb408f6a99f2b43ec6980e903a5d3525cd2aab (diff) | |
download | tqt3-6250349b0b0a48a23b6cd847e70330e90c812bcc.tar.gz tqt3-6250349b0b0a48a23b6cd847e70330e90c812bcc.zip |
Make TQConnectionList sharedfeat/dedup-tqobject
This commit fixes crashes caused by modifications of TQobject
connections from the slots invoked by its signals. Up to recent time
those were hidden by implementation specificities in
TQObject::activate_signal(), so they would appear only under quite
peculiar circumstances, but after attempts to de-duplicate the code they
surfaced up.
Besides that the patch de-duplicates some code in
TQObject::disconnectInternal().
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
Diffstat (limited to 'src/kernel/ntqsignalslotimp.h')
-rw-r--r-- | src/kernel/ntqsignalslotimp.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/kernel/ntqsignalslotimp.h b/src/kernel/ntqsignalslotimp.h index 375f8eaa8..7e6989197 100644 --- a/src/kernel/ntqsignalslotimp.h +++ b/src/kernel/ntqsignalslotimp.h @@ -47,7 +47,7 @@ #include "ntqptrvector.h" #endif // QT_H -class TQ_EXPORT TQConnectionList : public TQPtrList<TQConnection> +class TQ_EXPORT TQConnectionList : public TQPtrList<TQConnection>, public TQShared { public: TQConnectionList() : TQPtrList<TQConnection>() {} @@ -55,6 +55,23 @@ public: ~TQConnectionList() { clear(); } TQConnectionList &operator=(const TQConnectionList &list) { return (TQConnectionList&)TQPtrList<TQConnection>::operator=(list); } + + TQConnectionList *deepCopy() const { + TQConnectionList *rv = new TQConnectionList; + TQ_CHECK_PTR( rv ); + for( TQConnectionList::ConstIterator it = this->constBegin(), + end = this->constEnd(); + it!=end;++it + ) { + TQConnection *c = + new TQConnection((*it)->object(), (*it)->member(), + (*it)->memberName(), (*it)->memberType()); + + TQ_CHECK_PTR( c ); + rv->append(c); + } + return rv; + } }; class TQ_EXPORT TQConnectionListIt : public TQPtrListIterator<TQConnection> |