X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fjogshuttle.cpp;h=f9049511dceefcc568ecf037e33c2fdec5b3ea0c;hb=2b4a438e09bf373960bcd127dcf6701a74b3ee22;hp=16fd171f4d0e17ce80a982a84c1647716de610db;hpb=60eb4b82541e1560403e52c2d078c0b4b100de7d;p=kdenlive diff --git a/src/jogshuttle.cpp b/src/jogshuttle.cpp index 16fd171f..f9049511 100644 --- a/src/jogshuttle.cpp +++ b/src/jogshuttle.cpp @@ -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)