fix backend not deallocating due to circular reference
This commit is contained in:
parent
e9f4ac0e14
commit
a8e6fbd0fd
@ -176,6 +176,11 @@ def proto_progress_to_native(progress: pb.Progress) -> Progress:
|
|||||||
else:
|
else:
|
||||||
assert_impossible_literal(kind)
|
assert_impossible_literal(kind)
|
||||||
|
|
||||||
|
def _on_progress(progress_bytes: bytes) -> bool:
|
||||||
|
progress = pb.Progress()
|
||||||
|
progress.ParseFromString(progress_bytes)
|
||||||
|
native_progress = proto_progress_to_native(progress)
|
||||||
|
return hooks.bg_thread_progress_callback(True, native_progress)
|
||||||
|
|
||||||
class RustBackend:
|
class RustBackend:
|
||||||
def __init__(
|
def __init__(
|
||||||
@ -191,13 +196,7 @@ class RustBackend:
|
|||||||
log_path=log_path,
|
log_path=log_path,
|
||||||
)
|
)
|
||||||
self._backend = ankirspy.open_backend(init_msg.SerializeToString())
|
self._backend = ankirspy.open_backend(init_msg.SerializeToString())
|
||||||
self._backend.set_progress_callback(self._on_progress)
|
self._backend.set_progress_callback(_on_progress)
|
||||||
|
|
||||||
def _on_progress(self, progress_bytes: bytes) -> bool:
|
|
||||||
progress = pb.Progress()
|
|
||||||
progress.ParseFromString(progress_bytes)
|
|
||||||
native_progress = proto_progress_to_native(progress)
|
|
||||||
return hooks.bg_thread_progress_callback(True, native_progress)
|
|
||||||
|
|
||||||
def _run_command(
|
def _run_command(
|
||||||
self, input: pb.BackendInput, release_gil: bool = False
|
self, input: pb.BackendInput, release_gil: bool = False
|
||||||
|
Loading…
Reference in New Issue
Block a user