mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +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
|
@ -621,7 +621,9 @@ impl Runtime {
|
|||
&*(closure as *mut NetworkingTaskSource);
|
||||
let runnable = Runnable(dispatchable);
|
||||
let task = task!(dispatch_to_event_loop_message: move || {
|
||||
runnable.run(RustRuntime::get(), Dispatchable_MaybeShuttingDown::NotShuttingDown);
|
||||
if let Some(cx) = RustRuntime::get() {
|
||||
runnable.run(cx.as_ptr(), Dispatchable_MaybeShuttingDown::NotShuttingDown);
|
||||
}
|
||||
});
|
||||
|
||||
networking_task_src.queue_unconditionally(task).is_ok()
|
||||
|
@ -801,6 +803,8 @@ impl Runtime {
|
|||
impl Drop for Runtime {
|
||||
#[allow(unsafe_code)]
|
||||
fn drop(&mut self) {
|
||||
self.microtask_queue.clear();
|
||||
|
||||
unsafe {
|
||||
DeleteJobQueue(self.job_queue);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue