eglfs: delete cursor textures in the destructor
authorGirish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Wed, 16 May 2012 18:13:54 +0000 (11:13 -0700)
committerQt by Nokia <qt-info@nokia.com>
Thu, 17 May 2012 03:14:31 +0000 (05:14 +0200)
Change-Id: I7e86313134c428bacda41f5e5401ebc392ceecd8
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
src/plugins/platforms/eglfs/qeglfscursor.cpp

index a6e1a32..f997b64 100644 (file)
@@ -42,6 +42,7 @@
 #include "qeglfscursor.h"
 #include <QtGui/qwindowsysteminterface_qpa.h>
 #include <QtGui/QOpenGLShaderProgram>
+#include <QtGui/QOpenGLContext>
 #include <QtDebug>
 
 QT_BEGIN_NAMESPACE
@@ -61,7 +62,12 @@ QEglFSCursor::QEglFSCursor(QEglFSScreen *screen)
 
 QEglFSCursor::~QEglFSCursor()
 {
-    // destroy atlas?
+    if (QOpenGLContext::currentContext()) {
+        if (m_cursor.shape == Qt::BitmapCursor && m_cursor.texture)
+            glDeleteTextures(1, &m_cursor.texture);
+
+        glDeleteTextures(1, &m_cursorAtlas.texture);
+    }
 }
 
 void QEglFSCursor::createShaderPrograms()