Move multithreading patch up so that it's working in the GUI

This commit is contained in:
Alexis Métaireau 2025-04-07 14:58:59 +02:00 committed by Alex Pyrgiotis
parent f0bb65cb4e
commit d6451290db
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA
2 changed files with 6 additions and 4 deletions

View file

@ -4,6 +4,12 @@ import sys
logger = logging.getLogger(__name__)
# Call freeze_support() to avoid passing unknown options to the subprocess.
# See https://github.com/freedomofpress/dangerzone/issues/873
import multiprocessing
multiprocessing.freeze_support()
try:
from . import vendor # type: ignore [attr-defined]

View file

@ -3,7 +3,6 @@ import os
import platform
import tempfile
import typing
from multiprocessing import freeze_support
from multiprocessing.pool import ThreadPool
from pathlib import Path
from typing import List, Optional
@ -1238,9 +1237,6 @@ class DocumentsListWidget(QtWidgets.QListWidget):
def start_conversion(self) -> None:
if not self.thread_pool_initized:
max_jobs = self.dangerzone.isolation_provider.get_max_parallel_conversions()
# Call freeze_support() to avoid passing unknown options to the subprocess.
# See https://github.com/freedomofpress/dangerzone/issues/873
freeze_support()
self.thread_pool = ThreadPool(max_jobs)
for doc in self.docs_list: