mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
script: Handle null contexts better during JS runtime shutdown. (#34769)
* script: Handle null contexts better during JS runtime shutdown. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * lock file Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net> Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> Co-authored-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
981616f918
commit
4a6d2f8ff0
8 changed files with 41 additions and 30 deletions
|
@ -70,7 +70,9 @@ impl Clone for ServoJSPrincipals {
|
|||
impl Drop for ServoJSPrincipals {
|
||||
#[inline]
|
||||
fn drop(&mut self) {
|
||||
unsafe { JS_DropPrincipals(Runtime::get(), self.as_raw()) };
|
||||
if let Some(cx) = Runtime::get() {
|
||||
unsafe { JS_DropPrincipals(cx.as_ptr(), self.as_raw()) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue