/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crashping::{self, net}; use minidump_analyzer::MinidumpAnalyzer;
impl Drop for Utf16String { fn drop(&mutself) { if !self.chars.is_null() { // # Safety // We only own Utf16Strings which are created in Rust code, so when dropping, the // memory is that which we allocated (and thus is safe to deallocate). unsafe {
std::alloc::dealloc( self.chars as *mut u8, // unwrap() because the memory must have been a size that doesn't overflow when // it was originally allocated.
std::alloc::Layout::array::<u16>(self.len).unwrap(),
)
};
}
}
}
// Returns the value to be returned by the upload callback. #[no_mangle] pubextern"C"fn crashtools_upload_exception(non_fatal: bool, message: &Utf16String) -> i32 {
log::log!( if non_fatal {
log::Level::Warn
} else {
log::Level::Error
}, "failed to upload crash ping: {message}"
);
if non_fatal {
UPLOAD_NON_FATAL_ERROR
} else {
UPLOAD_FATAL_ERROR
}
}
#[no_mangle] pubextern"C"fn crashtools_free_string(result: Utf16String) { // This will happen anyway, but we're explicit about it for clarity.
drop(result);
}
impl<T> Drop for ExternFnClosure<T> { fn drop(&mutself) {
(self.drop)(self.data);
}
}
// # Safety // It is safe to Send ExternFnClosure as long as the callback and drop functions provided may be // called from arbitrary threads. unsafeimpl<T> Send for ExternFnClosure<T> {}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.