Introduce QQuickWindowQObjectCleanupJob.
authorGunnar Sletta <gunnar@sletta.org>
Sat, 23 Aug 2014 12:13:05 +0000 (14:13 +0200)
committerGunnar Sletta <gunnar@sletta.org>
Sun, 24 Aug 2014 06:32:14 +0000 (08:32 +0200)
Convenience for cleaning up texture providers. Private class for now,
we can maybe make it public in 5.5.

Change-Id: I3489fde2a268bc988634a16f87ee558b9ac5dba2
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
src/quick/items/qquickwindow_p.h

index c8f156e..f33e366 100644 (file)
@@ -62,6 +62,7 @@
 #include <QtCore/qthread.h>
 #include <QtCore/qmutex.h>
 #include <QtCore/qwaitcondition.h>
+#include <QtCore/qrunnable.h>
 #include <private/qwindow_p.h>
 #include <private/qopengl_p.h>
 #include <qopenglcontext.h>
@@ -287,6 +288,19 @@ private:
     bool _accepted;
 };
 
+class QQuickWindowQObjectCleanupJob : public QRunnable
+{
+public:
+    QQuickWindowQObjectCleanupJob(QObject *o) : object(o) { }
+    void run() Q_DECL_OVERRIDE { delete object; }
+    QObject *object;
+    static void schedule(QQuickWindow *window, QObject *object) {
+        Q_ASSERT(window);
+        Q_ASSERT(object);
+        window->scheduleRenderJob(new QQuickWindowQObjectCleanupJob(object), QQuickWindow::AfterSynchronizingStage);
+    }
+};
+
 Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickWindowPrivate::FocusOptions)
 
 QT_END_NAMESPACE