mirror of
https://github.com/chatmail/core.git
synced 2026-04-02 05:22:14 +03:00
fix(dc_receive_backup): Increase refcount before spawn
Otherwise it is possible for the context that is used in the spawn to be unreferenced. Really this should be caught by the borrow checker that ensures we only spawn things with a 'static lifetime, but we're handling raw pointers so it doesn't.
This commit is contained in:
committed by
link2xt
parent
87252ab053
commit
0ba8201797
@@ -4248,10 +4248,11 @@ pub unsafe extern "C" fn dc_receive_backup(
|
||||
Ok(qr) => qr,
|
||||
Err(_) => return 0,
|
||||
};
|
||||
let ctx = ctx.clone();
|
||||
spawn(async move {
|
||||
imex::get_backup(ctx, qr)
|
||||
imex::get_backup(&ctx, qr)
|
||||
.await
|
||||
.log_err(ctx, "Get backup failed")
|
||||
.log_err(&ctx, "Get backup failed")
|
||||
.ok();
|
||||
});
|
||||
1
|
||||
|
||||
Reference in New Issue
Block a user