Unset QtCamdevice viewfinder when Viewfinder is being destructed.
authorMohammed Sameer <msameer@foolab.org>
Sun, 8 Sep 2013 18:57:30 +0000 (21:57 +0300)
committerMohammed Sameer <msameer@foolab.org>
Sun, 8 Sep 2013 18:57:30 +0000 (21:57 +0300)
This fixes the following crash:
pure virtual method called
terminate called without an active exception
Aborted

Viewfinder was being destroyed and QtCamDevice was still holding a pointer
to garbage. It tries to stop viewfinder when the device gets stopped
which leads to the above mentioned crash.

declarative/viewfinder.cpp

index 841fd14..c8f7d44 100644 (file)
@@ -58,7 +58,13 @@ Viewfinder::Viewfinder(QQuickItem *parent) :
 }
 
 Viewfinder::~Viewfinder() {
+  if (m_cam) {
+    m_cam->stop(true);
+  }
 
+  if (m_dev) {
+    m_dev->setViewfinder(0);
+  }
 }
 
 bool Viewfinder::isRenderingEnabled() const {