From 895cfbfd01672af06dd71556b12899dbc2c7e8cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Thu, 3 May 2018 21:44:21 +0200 Subject: [PATCH] Qt: Add check for running toolbar reader thread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check if the reader thread is running before calling requestInterruption() in an attempt to avoid a crash when stop capture. Change-Id: I07cdc19eb42413ce421f05186314fc34c33041e6 Ping-Bug: 14631 Reviewed-on: https://code.wireshark.org/review/27316 Reviewed-by: Stig Bjørlykke --- ui/qt/interface_toolbar.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/qt/interface_toolbar.cpp b/ui/qt/interface_toolbar.cpp index 6db94c25d4..140cbc639e 100644 --- a/ui/qt/interface_toolbar.cpp +++ b/ui/qt/interface_toolbar.cpp @@ -771,7 +771,10 @@ void InterfaceToolbar::stopCapture() { if (interface_[ifname].reader_thread) { - interface_[ifname].reader_thread->requestInterruption(); + if (!interface_[ifname].reader_thread->isFinished()) + { + interface_[ifname].reader_thread->requestInterruption(); + } interface_[ifname].reader_thread = NULL; }