python: Acquire GIL on each loop iteration when calling callback

This commit is contained in:
JessicaTegner
2025-08-23 14:27:16 +02:00
committed by Caelan
parent 84f5fb9d44
commit 935a36c6ea

View File

@@ -63,15 +63,14 @@ impl UpdateManagerWrapper {
// Spawn a thread to handle progress updates
let progress_thread = thread::spawn(move || {
Python::with_gil(|py| {
while let Ok(progress) = receiver.recv() {
while let Ok(progress) = receiver.recv() {
Python::with_gil(|py| {
if let Err(e) = callback.call1(py, (progress,)) {
// Log error but continue - don't break the download
eprintln!("Progress callback error: {}", e);
break;
}
}
});
});
}
});
// Call download with the sender