Compare commits

..

2 Commits

Author SHA1 Message Date
Vxrtrauter f030795f10 fix: implement forced exit on shutdown and enhance shutdown handling 2026-03-07 22:10:45 +01:00
KeksNino eccdb2f068 fix file deletion when seeding 2026-03-07 21:56:07 +01:00
4 changed files with 17 additions and 9 deletions
+4 -2
View File
@@ -725,6 +725,8 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
def closeEvent(self, event: QCloseEvent):
closehelper()
event.accept()
from core.utils.general.shutdown import force_exit
force_exit()
def eventFilter(self, obj, event):
try:
@@ -881,15 +883,15 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
if download_path and os.path.exists(download_path):
try:
if os.path.isfile(download_path):
remove_download_log(magnet_link)
os.remove(download_path)
del state.active_downloads[magnet_link]
remove_download_log(magnet_link)
consoleLog(f"Deleted files for: {magnetdl.status().name}", True)
else:
import shutil
shutil.rmtree(download_path)
del state.active_downloads[magnet_link]
remove_download_log(magnet_link)
shutil.rmtree(download_path)
consoleLog(f"Deleted files for: {magnetdl.status().name}", True)
except Exception as e:
consoleLog(f"Error deleting files: {e}", True)
+6 -2
View File
@@ -6,6 +6,7 @@ import threading
import libtorrent as lt
from core.utils.data.state import state
from core.utils.logging.logs import consoleLog
from core.utils.general.shutdown import shutdown_event
global loop_running
@@ -116,9 +117,12 @@ def dl_status_loop():
loop_running = False
return
while state.active_downloads:
while state.active_downloads and not shutdown_event.is_set():
for magnet_uri, magnetdl in list(state.active_downloads.items()):
status = magnetdl.status()
try:
status = magnetdl.status()
except RuntimeError:
continue
if status.state == lt.torrent_status.seeding and magnet_uri not in completed_set:
consoleLog(f"Download completed: {status.name}")
+5 -4
View File
@@ -1,9 +1,10 @@
import threading
from core.network.libtorrent_misc import cleanup_session
from core.utils.general.wrappers import run_thread
import os
shutdown_event = threading.Event()
def closehelper():
run_thread(threading.Thread(target=cleanup_session))
shutdown_event.set()
shutdown_event.set()
def force_exit():
os._exit(0)
+2 -1
View File
@@ -33,7 +33,8 @@ def run_gui():
def keyboardinterrupthandler(signum, frame):
closehelper()
windowCloseHelper()
from core.utils.general.shutdown import force_exit
force_exit()
def main():
start_time = time.perf_counter()