From 8a9fcfeb55afaaa5fcfb3fcc9aab2a6e4eb1a8f6 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 13 Mar 2017 19:13:37 +0100 Subject: [PATCH] try fix segfault with --enable-cleanup Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/76530e2c05f6c4f31f0484e91adffab69daa0f37 Author: Jacek Jendrzej Date: 2017-03-13 (Mon, 13 Mar 2017) --- src/driver/streamts.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index f69dcea08..50fb9bbba 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -264,8 +264,11 @@ bool CStreamManager::Stop() if (!running) return false; running = false; - cancel(); - bool ret = (OpenThreads::Thread::join() == 0); + bool ret = false; + if (OpenThreads::Thread::CurrentThread() == this) { + cancel(); + ret = (OpenThreads::Thread::join() == 0); + } StopAll(); return ret; }