INNER CODE UNIT · Python
cleanup_stale_qt_ipc_artifacts
Matteo842/SaveState · main.py:75
def cleanup_stale_qt_ipc_artifacts(local_server_name: str, shared_memory_key: str) -> None:
"""Best-effort cleanup for stale Qt IPC artifacts on Linux.
This removes orphaned QLocalServer sockets and forces deletion of stale
QSharedMemory segments by attach+detach. It also tries to unlink known
temporary files created by Qt for shared memory and semaphores that can
persist after crashes.
"""
if platform.system() != "Linux":
return
# Import PySide6 here since this function is only called from GUI mode
try:
from PySide6.QtCore import QSharedMemory
from PySide6.QtNetwork import QLocalServer
except ImportError:
logging.debug("PySide6 not available for IPC cleanup, skipping.")
return