mirror of
https://github.com/chatmail/core.git
synced 2026-05-07 08:56:30 +03:00
try to fix swap_remove usage
This commit is contained in:
@@ -247,11 +247,19 @@ pub unsafe fn dc_mimeparser_parse(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if need_drop {
|
if need_drop {
|
||||||
free(mimeparser.parts[1].msg as *mut libc::c_void);
|
let mut filepart = mimeparser.parts.swap_remove(1);
|
||||||
let mut textpart = mimeparser.parts.swap_remove(0);
|
|
||||||
mimeparser.parts[1].msg = textpart.msg;
|
// clear old one
|
||||||
textpart.msg = 0 as *mut libc::c_char;
|
free(filepart.msg as *mut libc::c_void);
|
||||||
dc_mimepart_unref(textpart);
|
|
||||||
|
// insert new one
|
||||||
|
filepart.msg = mimeparser.parts[0].msg;
|
||||||
|
|
||||||
|
// clear old one out
|
||||||
|
let old = std::mem::replace(&mut mimeparser.parts[0], filepart);
|
||||||
|
|
||||||
|
// unref old one
|
||||||
|
dc_mimepart_unref(old);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !mimeparser.subject.is_null() {
|
if !mimeparser.subject.is_null() {
|
||||||
|
|||||||
Reference in New Issue
Block a user