From 4d02fe73837b785e76994e107f89fb995e721db4 Mon Sep 17 00:00:00 2001 From: Michel D'HOOGE Date: Tue, 19 Feb 2013 11:29:00 +0100 Subject: [PATCH] Virtual destructor for QAMQP::Frame::Base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To solve the GCC warning: deleting object of polymorphic class type ‘QAMQP::Frame::Method’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor] --- src/qamqp/amqp_frame.cpp | 5 ++++- src/qamqp/amqp_frame.h | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/qamqp/amqp_frame.cpp b/src/qamqp/amqp_frame.cpp index 3534bf3..fc02ce4 100644 --- a/src/qamqp/amqp_frame.cpp +++ b/src/qamqp/amqp_frame.cpp @@ -19,6 +19,9 @@ Type Base::type() const return Type(type_); } +Base::~Base() +{} + void Base::setChannel( qint16 channel ) { channel_ = channel; @@ -343,7 +346,7 @@ void QAMQP::Frame::writeField( qint8 valueType, QDataStream &s, const QVariant & { QByteArray tmp; if(withType) - s << valueType; // Çàïèøåì òèï ïîëÿ + s << valueType; switch(valueType) { diff --git a/src/qamqp/amqp_frame.h b/src/qamqp/amqp_frame.h index d5e91aa..bf861aa 100644 --- a/src/qamqp/amqp_frame.h +++ b/src/qamqp/amqp_frame.h @@ -109,6 +109,11 @@ namespace QAMQP */ Base(QDataStream& raw); + /*! + Base class virtual destructor + */ + virtual ~Base(); + /*! Frame type @detailed Return type of current frame.