mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
python: Acquire GIL on each loop iteration when calling callback
This commit is contained in:
@@ -63,15 +63,14 @@ impl UpdateManagerWrapper {
|
|||||||
|
|
||||||
// Spawn a thread to handle progress updates
|
// Spawn a thread to handle progress updates
|
||||||
let progress_thread = thread::spawn(move || {
|
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,)) {
|
if let Err(e) = callback.call1(py, (progress,)) {
|
||||||
// Log error but continue - don't break the download
|
// Log error but continue - don't break the download
|
||||||
eprintln!("Progress callback error: {}", e);
|
eprintln!("Progress callback error: {}", e);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Call download with the sender
|
// Call download with the sender
|
||||||
|
|||||||
Reference in New Issue
Block a user