diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 72c6e035d934de1b427e2f767a456717dedb1e17..3f496a4ffc6d1270be025ff313fb49c88ab9d97a 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1579,10 +1579,7 @@ QGLContextPrivate::QGLContextPrivate(QGLContext *context)
 {
     group = new QGLContextGroup(context);
 
-    if (qApp) {
-        texture_destroyer = new QGLTextureDestroyer;
-        texture_destroyer->moveToThread(qApp->thread());
-    }
+    texture_destroyer = new QGLTextureDestroyer;
 }
 
 QGLContextPrivate::~QGLContextPrivate()
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index ff9baf897165d8d830777795455a7be9eeb2c420..484c3ea2d98f3108a926d6440223648da2764ea2 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -335,25 +335,16 @@ QT_END_NAMESPACE
 Q_DECLARE_METATYPE(GLuint)
 QT_BEGIN_NAMESPACE
 
-class Q_OPENGL_EXPORT QGLTextureDestroyer : public QObject
+class Q_OPENGL_EXPORT QGLTextureDestroyer
 {
-    Q_OBJECT
 public:
-    QGLTextureDestroyer() : QObject() {
-        connect(this, SIGNAL(freeTexture(QGLContext *, QPlatformPixmap *, quint32)),
-                this, SLOT(freeTexture_slot(QGLContext *, QPlatformPixmap *, quint32)));
-    }
-    void emitFreeTexture(QGLContext *context, QPlatformPixmap *boundPixmap, GLuint id) {
-        emit freeTexture(context, boundPixmap, id);
+    void emitFreeTexture(QGLContext *context, QPlatformPixmap *, GLuint id) {
+        if (context->contextHandle())
+            (new QOpenGLSharedResourceGuard(context->contextHandle(), id, freeTextureFunc))->free();
     }
 
-Q_SIGNALS:
-    void freeTexture(QGLContext *context, QPlatformPixmap *boundPixmap, quint32 id);
-
-private slots:
-    void freeTexture_slot(QGLContext *context, QPlatformPixmap *boundPixmap, quint32 id) {
-        Q_UNUSED(boundPixmap);
-        QGLShareContextScope scope(context);
+private:
+    static void freeTextureFunc(QOpenGLFunctions *, GLuint id) {
         glDeleteTextures(1, &id);
     }
 };