mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Auto merge of #18302 - upsuper:atom-assert, r=bholley
Harden assert for creating atom from raw pointer One of Stylo's common assertion turns out to be from having a null Atom (see [Gecko 1385925 bug comment 7](https://bugzilla.mozilla.org/show_bug.cgi?id=1385925#c7)). It would be helpful if we can catch this kind of crash earlier via a release-assertion. This may regress performance to some extent which I'm not sure. But we can probably have it there for diagnosis for now, and remove later. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18302) <!-- Reviewable:end -->
This commit is contained in:
commit
421e6d8f91
1 changed files with 2 additions and 2 deletions
|
@ -265,7 +265,7 @@ impl Atom {
|
|||
/// called on it.
|
||||
#[inline]
|
||||
pub unsafe fn from_addrefed(ptr: *mut nsIAtom) -> Self {
|
||||
debug_assert!(!ptr.is_null());
|
||||
assert!(!ptr.is_null());
|
||||
unsafe {
|
||||
Atom(WeakAtom::new(ptr))
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ impl From<String> for Atom {
|
|||
impl From<*mut nsIAtom> for Atom {
|
||||
#[inline]
|
||||
fn from(ptr: *mut nsIAtom) -> Atom {
|
||||
debug_assert!(!ptr.is_null());
|
||||
assert!(!ptr.is_null());
|
||||
unsafe {
|
||||
let ret = Atom(WeakAtom::new(ptr));
|
||||
if !ret.is_static() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue