Doc: Fix faulty snippet in Video Overview page
authorTopi Reinio <topi.reinio@digia.com>
Tue, 5 Feb 2013 08:51:42 +0000 (09:51 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Tue, 19 Feb 2013 13:20:32 +0000 (14:20 +0100)
This change modifies setVideoSurface() in the snippet code
to be a bit more robust.

Task-number: QTBUG-29383

Change-Id: I2c691f19fe8f0912c1287597045da3a5579d2108
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
src/multimedia/doc/snippets/multimedia-snippets/video.cpp

index 68dca0d..8faf1ae 100644 (file)
@@ -86,8 +86,12 @@ public:
 
     void setVideoSurface(QAbstractVideoSurface *surface)
     {
+        if (m_surface != surface && m_surface && m_surface->isActive()) {
+            m_surface->stop();
+        }
         m_surface = surface;
-        m_surface->start(m_format);
+        if (m_surface)
+            m_surface->start(m_format);
     }
 
     // ...