diff --git a/kde/gui/lib9pstreamer.cpp b/kde/gui/lib9pstreamer.cpp index a079897..c18d5d1 100644 --- a/kde/gui/lib9pstreamer.cpp +++ b/kde/gui/lib9pstreamer.cpp @@ -144,16 +144,12 @@ void Lib9pStreamer::stopWorker() if (!m_worker) return; - m_worker->requestStop(); + m_worker->requestStop(); // Also closes fid to unblock read - // The worker may be blocked in Read(). We can't interrupt it directly, - // but we can abandon it. The thread will exit when: - // - Data arrives (checks stopRequested, exits) - // - EOF (server closes connection) - // - Error (connection lost) - // - // Give it a short time to exit gracefully, then abandon. - if (m_workerThread->wait(200)) { + // Give a very short time for the thread to notice the close. + // If it doesn't exit quickly, abandon it (it will clean up when the + // read finally returns). + if (m_workerThread->wait(10)) { // Thread exited cleanly delete m_worker; delete m_workerThread; @@ -164,7 +160,6 @@ void Lib9pStreamer::stopWorker() // Let the thread run to completion on its own connect(m_workerThread, &QThread::finished, m_worker, &QObject::deleteLater); connect(m_workerThread, &QThread::finished, m_workerThread, &QObject::deleteLater); - // Note: thread will eventually exit when the read completes or errors } m_worker = nullptr;