]> git.sesse.net Git - kdenlive/blobdiff - src/jogshuttle.cpp
Merge remote-tracking branch 'origin/master' into bugfix/jogshuttle
[kdenlive] / src / jogshuttle.cpp
index 16fd171f4d0e17ce80a982a84c1647716de610db..f9049511dceefcc568ecf037e33c2fdec5b3ea0c 100644 (file)
@@ -207,7 +207,7 @@ JogShuttle::JogShuttle(QString device, QObject *parent) :
 
 JogShuttle::~JogShuttle()
 {
-    if (m_shuttleProcess.isRunning()) m_shuttleProcess.exit();
+       stopDevice();
 }
 
 void JogShuttle::initDevice(QString device)
@@ -222,8 +222,19 @@ void JogShuttle::initDevice(QString device)
 
 void JogShuttle::stopDevice()
 {
-    if (m_shuttleProcess.isRunning())
+    if (m_shuttleProcess.isRunning()) {
+       /* the read fd is in blocking mode => stop_me is broken at the moment */
         m_shuttleProcess.stop_me = true;
+        m_shuttleProcess.exit();
+        /* give the thread some time to shutdown */
+        m_shuttleProcess.wait(100);
+
+        /* if still running - do it in the hardcore way */
+        if (m_shuttleProcess.isRunning()) {
+               m_shuttleProcess.terminate();
+            kDebug() << "/// terminate jogshuttle process\n";
+        }
+    }
 }
 
 void JogShuttle::customEvent(QEvent* e)