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:
Floris Bruynooghe
2023-03-22 17:34:00 +01:00
committed by link2xt
parent 87252ab053
commit 0ba8201797

View File

@@ -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