feat: Change quit move thread logic.

This commit is contained in:
sunwen
2025-06-11 16:47:18 +08:00
parent 206fd7b913
commit af9a734bf3
2 changed files with 7 additions and 2 deletions

View File

@@ -15,7 +15,7 @@ MoveWorker::MoveWorker(unsigned long ourPort, const std::string& ourTitle, QObje
MoveWorker::~MoveWorker() MoveWorker::~MoveWorker()
{ {
mMoveStoreThread->quit(); mMoveStoreThread->terminate();
mMoveStoreThread->wait(); mMoveStoreThread->wait();
mMoveStoreThread->deleteLater(); mMoveStoreThread->deleteLater();
return; return;
@@ -106,6 +106,10 @@ void MoveWorker::moveByStudyInstanceUID(const QString& studyInstanceUID)
{ {
emit notifyMoveDone(0, mStrOutputDirectory); emit notifyMoveDone(0, mStrOutputDirectory);
} }
else
{
emit notifyMoveDone(1, "");
}
} }
mScu->releaseAssociation(); mScu->releaseAssociation();
} }

View File

@@ -81,7 +81,7 @@ ImportWidget::~ImportWidget()
if (mMoveWorkerThread != nullptr && !mMoveWorkerThread->isFinished()) if (mMoveWorkerThread != nullptr && !mMoveWorkerThread->isFinished())
{ {
mMoveWorkerThread->exit(); mMoveWorkerThread->terminate();
mMoveWorkerThread->wait(); mMoveWorkerThread->wait();
delete mMoveWorkerThread; delete mMoveWorkerThread;
mMoveWorkerThread = nullptr; mMoveWorkerThread = nullptr;
@@ -645,6 +645,7 @@ void ImportWidget::executeCMove(const QModelIndex &current)
return; return;
} }
mMoveWorker->setPacsInfo(peerIP,peerPort,peerTitle); mMoveWorker->setPacsInfo(peerIP,peerPort,peerTitle);
mMoveWorker->setListenInfo(ourTitle, ourPort);
mMoveWorker->setOutputDirectory(QString::fromStdString(outDirectory)); mMoveWorker->setOutputDirectory(QString::fromStdString(outDirectory));
QMetaObject::invokeMethod(mMoveWorker, "moveByStudyInstanceUID", Qt::QueuedConnection, Q_ARG(QString, QString::fromStdString(studyInstanceUID))); QMetaObject::invokeMethod(mMoveWorker, "moveByStudyInstanceUID", Qt::QueuedConnection, Q_ARG(QString, QString::fromStdString(studyInstanceUID)));