diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2010-11-08 09:05:28 (GMT) |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2010-11-08 12:03:51 (GMT) |
commit | ee958e086847e2131f9b746e5c6de4491ae1f44b (patch) | |
tree | 7396429debac0cc0074fd202c6af4bad25429c8b /tests/auto/qgl | |
parent | e600496d74c607f2316dd66f117a3d693769cca2 (diff) | |
download | Qt-ee958e086847e2131f9b746e5c6de4491ae1f44b.zip Qt-ee958e086847e2131f9b746e5c6de4491ae1f44b.tar.gz Qt-ee958e086847e2131f9b746e5c6de4491ae1f44b.tar.bz2 |
Prevented race condition on texture destruction.
When texture destruction was triggered from a different thread, we
posted a signal to the QGLSignalProxy. However, before the signal is
delivered the corresponding QGLContext might be destroyed in the main
thread. We need to post a signal to a QObject which is destroyed when
the QGLContext is destroyed instead, to prevent trying to access an
invalid QGLContext pointer.
Task-number: QT-4238
Reviewed-by: Gunnar Sletta
Diffstat (limited to 'tests/auto/qgl')
-rw-r--r-- | tests/auto/qgl/tst_qgl.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index 4220b45..e38bf42 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -2335,8 +2335,10 @@ public: Widget() : iterations(0) , display(0) + , producer(new Producer) { startTimer(400); + connect(this, SIGNAL(destroyed()), producer, SLOT(deleteLater())); } int iterations; @@ -2348,15 +2350,15 @@ protected: delete display; display = new DisplayWidget(this); - connect(&producer, SIGNAL(imageReady(const QImage &)), display, SLOT(setImage(const QImage &))); + connect(producer, SIGNAL(imageReady(const QImage &)), display, SLOT(setImage(const QImage &))); display->setGeometry(rect()); display->show(); } private: - Producer producer; DisplayWidget *display; + Producer *producer; }; } @@ -2369,6 +2371,8 @@ void tst_QGL::threadImages() while (widget->iterations <= 5) { qApp->processEvents(); } + + delete widget; } class tst_QGLDummy : public QObject |