Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Gui/QtGUIutils/QtApplication.py
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,15 @@ def closeEvent(self, event):
)

if reply == QMessageBox.Yes:
# If running with the Tessie coldbox controller, ensure its
# background monitoring thread is stopped to avoid worker leaks.
if site_settings.cooler == "Tessie":
try:
if hasattr(self, 'tessie_widget') and self.tessie_widget is not None:
if hasattr(self.tessie_widget, 'stop_temperature_monitoring'):
self.tessie_widget.stop_temperature_monitoring()
except Exception:
logger.debug("Failed to stop Tessie monitoring cleanly during application shutdown")
print("Application terminated")
if self.instruments is not None:
self.instruments.off()
Expand Down
8 changes: 4 additions & 4 deletions Gui/QtGUIutils/TessieCoolingApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
QWidget, QPushButton, QVBoxLayout, QHBoxLayout, QGridLayout,
QLabel, QGroupBox, QFrame
)
from PyQt5.QtCore import QTimer, pyqtSignal, QThread, QObject, pyqtSlot
from PyQt5.QtCore import QTimer, pyqtSignal, QThread, QObject, pyqtSlot,QMetaObject, Qt
from PyQt5.QtGui import QFont
from Gui.python.logging_config import get_logger
import threading
Expand Down Expand Up @@ -241,9 +241,9 @@ def stop_temperature_monitoring(self):
"""Stop the QThread-based monitoring."""
if self._worker is not None:
try:
self._worker.stop()
except Exception:
pass
QMetaObject.invokeMethod(self._worker, "stop", Qt.QueuedConnection)
except Exception as e:
logger.debug(f"Failed to queue worker.stop(): {e}")
if self._thread is not None:
self._thread.quit()
self._thread.wait(2000)
Expand Down
Loading