Skip to content

Commit

Permalink
BUG: Update ctkDICOMTester to always kill "storescp" process on destr…
Browse files Browse the repository at this point in the history
…uction

Since the DCMTK executable do not seem to configure a termination handler on
windows (using `SetConsoleCtrlHandler()`) or on Unix (using `sigaction()`),
we speed up testing by simply killing the process.

> On Windows, terminate() posts a WM_CLOSE message to all top-level
> windows of the process and then to the main thread of the process
> itself. On Unix and macOS the SIGTERM signal is sent.
>
> Console applications on Windows that do not run an event loop, or whose
> event loop does not handle the WM_CLOSE message, can only be terminated
> by calling kill().

Source: https://doc.qt.io/qt-5/qprocess.html#terminate
  • Loading branch information
jcfr committed Jan 18, 2024
1 parent d49a7a9 commit 29aae66
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Libs/DICOM/Core/ctkDICOMTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ ctkDICOMTesterPrivate::ctkDICOMTesterPrivate(ctkDICOMTester& o): q_ptr(&o)
//------------------------------------------------------------------------------
ctkDICOMTesterPrivate::~ctkDICOMTesterPrivate()
{
this->STORESCPProcess->terminate();
if (!this->STORESCPProcess->waitForFinished())
// Do not wait for the process to finish.
// See https://doc.qt.io/qt-5/qprocess.html#terminate
// this->STORESCPProcess->terminate();
// if (!this->STORESCPProcess->waitForFinished())
{
this->STORESCPProcess->kill();
}
Expand Down

0 comments on commit 29aae66

Please sign in to comment.