diff options
author | Gunnar Sletta <gunnar.sletta@nokia.com> | 2011-08-24 06:57:27 +0200 |
---|---|---|
committer | Gunnar Sletta <gunnar.sletta@nokia.com> | 2011-08-24 08:00:58 +0200 |
commit | 86680a46021d89e1ff77275e0427c4b20a19a270 (patch) | |
tree | 240dde763479cc48c18af3f72c6a9f821af39fc5 /src/declarative/items | |
parent | 6a674ccc0b251867d9ae651885117a44b4fe5bcd (diff) |
Warn when grab() is called outside the GUI thread.
Change-Id: I24eb1c5c884e80017d8a1123120538553e825064
Reviewed-on: http://codereview.qt.nokia.com/3443
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Sarah Jane Smith <sarah.j.smith@nokia.com>
Diffstat (limited to 'src/declarative/items')
-rw-r--r-- | src/declarative/items/qsgcanvas.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/declarative/items/qsgcanvas.cpp b/src/declarative/items/qsgcanvas.cpp index 1caee4fd72..33d661e089 100644 --- a/src/declarative/items/qsgcanvas.cpp +++ b/src/declarative/items/qsgcanvas.cpp @@ -1843,6 +1843,8 @@ QGLFramebufferObject *QSGCanvas::renderTarget() const This function might not work if the view is not visible. \warning Calling this function will cause performance problems. + + \warning This function can only be called from the GUI thread. */ QImage QSGCanvas::grabFrameBuffer() { @@ -2193,6 +2195,11 @@ QImage QSGCanvasRenderThread::grab() if (!isRunning()) return QImage(); + if (QThread::currentThread() != qApp->thread()) { + qWarning("QSGCanvas::grabFrameBuffer: can only be called from the GUI thread"); + return QImage(); + } + #ifdef THREAD_DEBUG printf("GUI: doing a pixelwise grab..\n"); #endif |