]> git.cworth.org Git - apitrace/commitdiff
Deep copy the blob data.
authorZack Rusin <zack@kde.org>
Tue, 27 Sep 2011 16:04:10 +0000 (12:04 -0400)
committerZack Rusin <zack@kde.org>
Tue, 27 Sep 2011 16:05:34 +0000 (12:05 -0400)
Fixes a memory leak.

gui/apitracecall.cpp

index 807476295cb606a3da26d868e5ebeb46ca7f1cbc..f500d90c8b2f62b89a12c626a62418e5a88125c8 100644 (file)
@@ -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);
 }