From: Zack Rusin Date: Tue, 27 Sep 2011 16:04:10 +0000 (-0400) Subject: Deep copy the blob data. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=9523768fe89d08e8e21922a973e0f8424459e9b9;p=apitrace Deep copy the blob data. Fixes a memory leak. --- diff --git a/gui/apitracecall.cpp b/gui/apitracecall.cpp index 8074762..f500d90 100644 --- a/gui/apitracecall.cpp +++ b/gui/apitracecall.cpp @@ -208,16 +208,7 @@ void VariantVisitor::visit(Trace::Array *array) void VariantVisitor::visit(Trace::Blob *blob) { - //XXX - //FIXME: this is a nasty hack. Trace::Blob's can't - // delete the contents in the destructor because - // the data is being used by other calls. We piggy back - // on that assumption and don't deep copy the data. If - // Blob's will start deleting the data we will need to - // start deep copying it or switch to using something like - // Boost's shared_ptr or Qt's QSharedPointer to handle it - blob->toPointer(true); - QByteArray barray = QByteArray::fromRawData(blob->buf, blob->size); + QByteArray barray = QByteArray(blob->buf, blob->size); m_variant = QVariant(barray); }