diff --git a/src/protocol/KafkaDataTypes.h b/src/protocol/KafkaDataTypes.h index df1e9802..1a1a38cc 100644 --- a/src/protocol/KafkaDataTypes.h +++ b/src/protocol/KafkaDataTypes.h @@ -107,11 +107,14 @@ public: KafkaList& operator= (const KafkaList& copy) { - this->~KafkaList(); - this->ref = copy.ref; - ++*this->ref; - this->t_list = copy.t_list; - this->curpos = copy.curpos; + if (this != ©) + { + this->~KafkaList(); + this->ref = copy.ref; + ++*this->ref; + this->t_list = copy.t_list; + this->curpos = copy.curpos; + } return *this; } @@ -227,10 +230,13 @@ public: KafkaMap& operator= (const KafkaMap& copy) { - this->~KafkaMap(); - this->ref = copy.ref; - ++*this->ref; - this->t_map = copy.t_map; + if (this != ©) + { + this->~KafkaMap(); + this->ref = copy.ref; + ++*this->ref; + this->t_map = copy.t_map; + } return *this; } @@ -621,10 +627,13 @@ public: KafkaConfig& operator= (const KafkaConfig& copy) { - this->~KafkaConfig(); - this->ptr = copy.ptr; - this->ref = copy.ref; - ++*this->ref; + if (this != ©) + { + this->~KafkaConfig(); + this->ptr = copy.ptr; + this->ref = copy.ref; + ++*this->ref; + } return *this; } @@ -724,10 +733,13 @@ public: KafkaRecord& operator= (KafkaRecord& copy) { - this->~KafkaRecord(); - this->ptr = copy.ptr; - this->ref = copy.ref; - ++*this->ref; + if (this != ©) + { + this->~KafkaRecord(); + this->ptr = copy.ptr; + this->ref = copy.ref; + ++*this->ref; + } return *this; } @@ -851,13 +863,16 @@ public: KafkaToppar& operator= (KafkaToppar& copy) { - this->~KafkaToppar(); - this->ptr = copy.ptr; - this->ref = copy.ref; - ++*this->ref; - this->curpos = copy.curpos; - this->startpos = copy.startpos; - this->endpos = copy.endpos; + if (this != ©) + { + this->~KafkaToppar(); + this->ptr = copy.ptr; + this->ref = copy.ref; + ++*this->ref; + this->curpos = copy.curpos; + this->startpos = copy.startpos; + this->endpos = copy.endpos; + } return *this; } @@ -1039,11 +1054,14 @@ public: KafkaBroker& operator= (const KafkaBroker& copy) { - this->~KafkaBroker(); - this->ptr = copy.ptr; - this->ref = copy.ref; - if (this->ref) - ++*this->ref; + if (this != ©) + { + this->~KafkaBroker(); + this->ptr = copy.ptr; + this->ref = copy.ref; + if (this->ref) + ++*this->ref; + } return *this; } @@ -1200,10 +1218,13 @@ public: KafkaMeta& operator= (KafkaMeta& copy) { - this->~KafkaMeta(); - this->ptr = copy.ptr; - this->ref = copy.ref; - ++*this->ref; + if (this != ©) + { + this->~KafkaMeta(); + this->ptr = copy.ptr; + this->ref = copy.ref; + ++*this->ref; + } return *this; }