| 368 | } |
| 369 | |
| 370 | static void gjs_context_dispose(GObject* object) { |
| 371 | gjs_debug(GJS_DEBUG_CONTEXT, "JS shutdown sequence"); |
| 372 | |
| 373 | GjsContextPrivate* gjs = GjsContextPrivate::from_object(object); |
| 374 | |
| 375 | g_assert(gjs->is_owner_thread() && |
| 376 | "Gjs Context disposed from another thread"); |
| 377 | |
| 378 | // Profiler must be stopped and freed before context is shut down |
| 379 | gjs->free_profiler(); |
| 380 | |
| 381 | /* Stop accepting entries in the toggle queue before running dispose |
| 382 | * notifications, which causes all GjsMaybeOwned instances to unroot. We |
| 383 | * don't want any objects to toggle down after that. */ |
| 384 | gjs_debug(GJS_DEBUG_CONTEXT, "Shutting down toggle queue"); |
| 385 | gjs_object_clear_toggles(); |
| 386 | gjs_object_shutdown_toggle_queue(); |
| 387 | |
| 388 | if (gjs->context()) |
| 389 | ObjectInstance::context_dispose_notify(nullptr, object); |
| 390 | |
| 391 | gjs_debug(GJS_DEBUG_CONTEXT, |
| 392 | "Notifying external reference holders of GjsContext dispose"); |
| 393 | G_OBJECT_CLASS(gjs_context_parent_class)->dispose(object); |
| 394 | |
| 395 | gjs->dispose(); |
| 396 | } |
| 397 | |
| 398 | void GjsContextPrivate::free_profiler() { |
| 399 | gjs_debug(GJS_DEBUG_CONTEXT, "Stopping profiler"); |
nothing calls this directly
no test coverage detected