summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2020-03-07 11:28:42 +0100
committerStanislaw Halik <sthalik@misaki.pl>2020-03-07 11:28:42 +0100
commit0155af407c3bd1f3d805b77881476bdc0de8328d (patch)
treea4646fd2b62eec140b96d4edabb779484544e38e
parent7de0cb1cb75a499eaf4717b6ba781bfa159b7b7f (diff)
fix qprocess race on unix
-rw-r--r--proto-wine/ftnoir_protocol_wine.cpp5
-rw-r--r--video-ps3eye/module.cpp14
2 files changed, 5 insertions, 14 deletions
diff --git a/proto-wine/ftnoir_protocol_wine.cpp b/proto-wine/ftnoir_protocol_wine.cpp
index 5955b507..aabaa30c 100644
--- a/proto-wine/ftnoir_protocol_wine.cpp
+++ b/proto-wine/ftnoir_protocol_wine.cpp
@@ -24,8 +24,9 @@ wine::~wine()
}
if (!exit)
{
- wrapper.kill();
- wrapper.waitForFinished(-1);
+ if (wrapper.state() != QProcess::NotRunning)
+ wrapper.kill();
+ wrapper.waitForFinished(1000);
}
#endif
//shm_unlink("/" WINE_SHM_NAME);
diff --git a/video-ps3eye/module.cpp b/video-ps3eye/module.cpp
index 26b771e2..fe6b51b8 100644
--- a/video-ps3eye/module.cpp
+++ b/video-ps3eye/module.cpp
@@ -112,19 +112,9 @@ void ps3eye_camera::stop()
if (wrapper.state() != QProcess::NotRunning)
{
- if (shm.success())
- {
- volatile auto& ptr = *(ps3eye::shm*)shm.ptr();
- ptr.in.do_exit = true;
- if (!wrapper.waitForFinished(500))
- wrapper.kill();
- wrapper.waitForFinished(-1);
- }
- else
- {
+ if (wrapper.state() != QProcess::NotRunning)
wrapper.kill();
- wrapper.waitForFinished(-1);
- }
+ wrapper.waitForFinished(1000);
}
}