Fixed memory leak in assign operator of QOpenGLBuffer
authorVadim Zakondyrin <thekondr@crystalnix.com>
Sat, 17 Nov 2012 03:10:51 +0000 (10:10 +0700)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 19 Nov 2012 22:21:13 +0000 (23:21 +0100)
Change-Id: I47f9128b54770bae7a63f82bf66ca16144b67c55
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/gui/opengl/qopenglbuffer.cpp

index f84bbcb..11c85f8 100644 (file)
@@ -209,8 +209,10 @@ QOpenGLBuffer &QOpenGLBuffer::operator=(const QOpenGLBuffer &other)
 {
     if (d_ptr != other.d_ptr) {
         other.d_ptr->ref.ref();
-        if (!d_ptr->ref.deref())
+        if (!d_ptr->ref.deref()) {
             destroy();
+            delete d_ptr;
+        }
         d_ptr = other.d_ptr;
     }
     return *this;